You can sometimes innocently include some text into your script that when presented with adocument.write() gets completely misunderstood by the HTML parser. This will almost certainly be due to the presence of "<" and ">" characters in the output. It is likely that the browser will see what it thinks is a tag, but then ignore it according to the "I don't know what it is - so I won't display it" rule, as it won't be a recognized tag.
Use HTML escapes to output the character as intended.
This is important for the following characters if not for others:
< becomes <
> becomes >
& becomes &
See also: | Pitfalls |
Prev | Home | Next |
HTML Component | Up | HTML file |
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. |