You cannot use the string '</SCRIPT>' within an inline JavaScript fragment. Even if it is enclosed inside quotation marks, it will still be seen by the parser and interpreted as a closure to the <SCRIPT> tag. You will need to hide it by constructing the string from component parts and using concatenation techniques to manufacture the string you need.
If you need to say this:
var myScriptTag = '</SCRIPT>';
Then you should do this:
var myScriptTag = '<' + '/SCRIPT' + '>';
which should hide the tag from the parser.
Another alternative is to escape the slash character with a backslash like this:
var myScriptTag = '<\/SCRIPT>';
Look at that previous line carefully, and see how the forward slash is preceeded by a backslash. After a long day cranking code out that might look like an upper case V, so it might be best to use the concatenation technique.
| Prev | Home | Next |
| <SCRIPT TYPE="..."> | Up | <SCRIPT ARCHIVE="..."> |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||