Click to See Complete Forum and Search --> : question backslash escape key \"


Gasolene
07-15-2003, 12:15 PM
question about the backslash escape key...


var url = "javascript:getPage(\"eventlist.php?mo=" + mo + "&count=" + count + "&\"" + ", 450, 350);";

url returns this...

javascript:getPage("eventlist.php?mo=6&count=14&", 450, 350);

-------------------------------------

var url = "javascript:getPage(\'eventlist.php?mo=" + mo + "&count=" + count + "&\'" + ", 450, 350);";

url returns this...

javascript:getPage(


------------
WHY???

the only difference is the \" is replaced with a \'


I want this (same as top but with single ' instead of double "

javascript:getPage('eventlist.php?mo=6&count=14&', 450, 350);

AdamGundry
07-15-2003, 12:25 PM
You don't need to escape single quotes if you use double quotes for containing the string (and vice versa) so you can do this:

var url = "javascript:getPage('eventlist.php?mo=" + mo + "&count=" + count + "&'" + ", 450, 350);";

Adam

Gasolene
07-15-2003, 12:33 PM
thnx