Coding Cookbook/JavaScript Encode
Appearance
Encode special characters in a string, so that it can be displayed using JavaScript
VBScript solution
[edit | edit source]function JSEncode (sInput) JSEncode = sInput JSEncode = Replace (JSEncode, chr(0), "") JSEncode = Replace (JSEncode, "'", "\'") JSEncode = Replace (JSEncode, """", "\""") JSEncode = Replace (JSEncode, "&", "\x26") end function