I need to get a value from an ASP string variable into a JavaScript string variable, however if the ASP variable has a single or double-quote in it, it doesn't work.
{% vbText = "this" & Chr(34) & "that" %}
var jsText = '{%=vbText%}';
I get an error.
If I escape the vbString:
{% vbText = "this"that" %}
var jsText = '{%=vbText%}';
I don't get an error, but when I put the text into a form, it displays the HTML entity, not the single quote.
The only thing I can think of is to escape the special chars, but use a JS function to decode them... but I'm not that good at JavaScript, so I need some help writing such a function.



Reply With Quote

Bookmarks