ASP 文字防复制乱码函数
2011-10-19 16:19:57 862

<%
'作用:文字防复制乱码 函数
'参数str 为原文,str1作者也是你自己,reslut产生乱码的种子

Function ReadToCode(Str, Str1, result)
    Dim Name
    Dim i, j, k
    If IsNull(Str)
        Then ReadToCode = ""
        Exit Function
    End If
    Randomize k = InStr(Str, "</p>")
    Do While k>0 result = ""
        For i = 0 To 19
            j = Int(128 * Rnd) + 1
            If j = 60 Or j = 62
                Then j = j + 1
            End If
            result = result&Chr(j)
            ' 产生随机数。
        Next
        result = "<span style='DISPLAY: none'>"&result&"清风细雨阁|bbs.700net.com</span>"
        Str = Replace(Str, "</p>", result&"<'/p>", 1, 1)
        k = InStr(Str, "</p>")
    Loop
    Str = Replace(Str, "<'/p>", "</p>")
    k = InStr(Str, "<br />")
    Do While k>0 result = ""
        For i = 0 To 19 j = Int(128 * Rnd) + 1
            If j = 60 Or j = 62
                Then j = j + 1
            End If
            result = result&Chr(j)
            ' 产生随机数。
        Next
        result = "<span style='DISPLAY: none'>"&result&"清风细雨阁|bbs.700net.com</span>"
        Str = Replace(Str, "<br />", result&"<'br>", 1, 1)
        k = InStr(Str, "<br />")
    Loop
    Str = Replace(Str, "<'br>", "<br />")
    k = InStr(Str, "<br/>")
    Do While k>0
        result = ""
        For i = 0 To 19
            j = Int(128 * Rnd) + 1
            If j = 60 Or j = 62 Then
                j = j + 1
            End If
            result = result&Chr(j)
            ' 产生随机数。
        Next
        result = "<span style='DISPLAY: none'>"&result&"清风细雨阁|bbs.700net.com</span>"
        result = result&"<font style=font-size:0px;color:#F5FBFF>阳光生活</font>"
        Str = Replace(Str, "<br/>", result&"<'br/>", 1, 1)
        k = InStr(Str, "<br/>")
    Loop
    Str = Replace(Str, "<'br/>", "<br/>")
    ReadToCode = Str&"<div align=right style='color=gray'>[版权归原作者及"&Str1&"共同拥有,转载请注明出处]</div>"
End Function

Dim a
a = "在复杂的娱乐圈更容易生存。"
'Only For Test
'response.write (a)
Dim b '为配合转换,字符串a的大小都替换成小写
b = ReadToCode(LCase(a), "blue2004", "www.xxx.com")
'Output  response.write b
%>