Page is a not externally linkable
andreasfriedrich - 1:06 pm on Nov 10, 2002 (gmt 0)
Why would you think that. They are contained within a string and have no special meaning within a string. You only need to escape a character if it has a special meaning but you want the literal character instead of this special behavior. " and ' are special in that they are used to delimit string literals. If you use ' as a delimiter and want to use it within the string as a literal character you need to escape it. It would have been easier to use double quotes as the delimiter since the single quote has no specuial meaning within a double quoted string. Why? Double quotes have no special meaning with in a string literal delimited by single quotes. Forward slashes are just ordinary characters. There is no need to escape them. Only for those very oŽld browsers that do not recognize the script element and that would therefor ignore the script tags and just display the javascript code. See also: String Literals [developer.netscape.com] in Client-Side JavaScript Guide. Andreas
My example works just fine in Netscape, Internet Explorer, Mozilla and Opera. Tedster already explained why you need those single quotes escaped. I think I need to escape the 2 semicolons var x = 'Aaron\'s Party'
var x = "Aaron's Party"
Escape all the double quotes with \" and the forward slashes with \/ The Comment Tags: '<!--' and '// -->' are important.
Be careful with quotes [webbuilder.netscape.com]