I need to write a VBScript function that can convert arbitrary strings into a string that I can safely use inside JavaScript. Something like this:
"Hello World"
-- becomes --
"Hello World"
"Hello
World"
-- becomes --
"Hello\nWorld"
"Hello
World"
-- becomes --
"Hello\n\tWorld"
"Hello'World"
-- becomes --
"Hello\'World"
I need to use the function like this:
var foo = '<p><%= thatfunction( Recordset( "TextField" ) ) %></p>';
I hope you got the point. The function does not have to be bullet-proof but close.