程序代碼
<%
'功能:定義轉換為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
%>