WEB开发网
开发学院WEB开发ASP ASP常用函数:Str4Js() 阅读

ASP常用函数:Str4Js()

 2009-07-20 10:41:38 来源:WEB开发网   
核心提示:程序代码<%'功能:定义转换为javascript字符串输出(约定Javascript中,用单引号引用字符串)'来源:http://www.cncms.com/asp.aspFunction Str4Js(sString) Str4Js = sString If IsNull(sString)

程序代码
<%
'功能:定义转换为javascript字符串输出(约定Javascript中,用单引号引用字符串)
'来源:http://www.cncms.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
%>

Tags:ASP 常用 函数

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接