View Single Post
  #10 (permalink)  
Old 08-09-2007, 12:54 PM
wige's Avatar
wige wige is online now
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,629
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Javascript and those naughty characters...

I see. The shopping cart looks like it is expecting the output to simply be embedded in the page. I would check the support for that cart software to see if they have an alternate code (they may have something like !--SCRIPT-- for JavaScript for example) that sanitizes the code. In the meantime a possible workaround is to change the first line of the script from:
HTML Code:
var outputstr = "!--TEXT-- "
to:
HTML Code:
var outputstr = '!--TEXT--'
outputstr = outputstr.replace('"', '\\"')
Note the quotes. In the first line, you are using single quotes. In the second line you are enclosing a double quote in a single quote. I am not absolutely sure about how many backslashes you need in the second line, but worst case scenario you could use """.
__________________
The best way to learn anything, is to question everything.
Reply With Quote