The <!-- ... --> comment markup is required in order to ensure that the code is not rendered as text by very old browsers which do not recognize the
<script> tag in HTML documents (although script-tags contained within the head-tag will never be rendered, thus the comment markup is not always necessary), and the LANGUAGE attribute is a deprecated HTML attribute which may be required for old browsers. However,
<script> tags in XHTML/XML documents will not work if commented out, as conformant XHTML/XML parsers ignore comments and also may encounter problems with --, < and > signs in scripts (for example, the integer decrement operator and the comparison operators). XHTML documents should therefore have scripts included as XML CDATA sections, by preceding them with
]]> from being parsed by the script.)
The easiest way to avoid this problem (and also as a best practice) is to use external script, e.g.:
Historically, a non-standard (non-W3C) attribute
language is used in the following context:
HTML elements may contain intrinsic events to which you can associate a script handler.
This also means every browser may treat the same script differently, and what works for one browser may fail in another browser, or even in a different version of the same browser. As with HTML, it is thus advisable to write standards-compliant code.
Object detection relies on testing for the existence of a property of an object.
A more complex example relies on using joined boolean tests:
In the above, the statement "
document.body.style" would ordinarily cause an error in a browser that does not have a "
document.body" property, but using the boolean operator "
&&" ensures that "
document.body.style" is never called if "document.body" doesn't exist. This technique is called minimal evaluation.
OpenLayers and TileCache: in our 6th open sources column, Schuyler Erle introduces two important packages for web-based mapping.(Column)
Dec 01, 2007; The most important innovation in mapping on the World Wide Web in the last few years has been the emergence of the client-side...