当前位置导航:炫浪网>>网络学院>>网页制作>>ASP教程

ASP常用函数:Str4Js()

程序代码
<%
'功能:定义转换为Javascript字符串输出(约定Javascript中,用单引号引用字符串)
'来源:http://www.knowsky.com/asp.asp

Function Str4Js(sString)
    Str4Js = sString
    If IsNull(sString) Then Str4Js = "" : Exit Function
    Str4Js = Replace(Str4Js, "\", "\\")
    Str4Js = Replace(Str4Js, "'", "\'")
    Str4Js = Replace(Str4Js, vbCrLf, "\n")
    Str4Js = Replace(Str4Js, vbCr, "\n")
    Str4Js = Replace(Str4Js, vbLf, "\n")
    Str4Js = Replace(Str4Js, vbTab, "\t")
    Str4Js = Replace(Str4Js, "script", "scr'+'ipt", 1, -1 , 1)
End Function
%>

相关内容
赞助商链接