The HTML character entities are useful for describing hard to type characters.
They are functionally similar to the back-quote substitutions that are available server-side with Netscape Enterprise Server.
MSIE version 3.0 introduced a means of passing JavaScript values into the HTML source space using a syntax that is similar to the character entity syntax. However, it is used in contexts that character entities were never intended to be used in. It is also advised as deprecated functionality in the HTML version 4.0 standard.
You might indicate an image width like this:
<IMG SRC="..." WIDTH="100">
The value for the image width can be taken from a JavaScript expression like this:
<IMG SRC="..." WIDTH="&{myWidth * myScaleFactor};">
This assumes that the values myWidth and myScaleFactor have already been defined in some earlier fragment of JavaScript.
The entity can be used to replace a single character in the tag attribute value so you can concatenate other characters such as percent signs if you use it in <HR> tags for example.
This functionality should be avoided and the usual client or server methods used to define the values in HTML tags.
Prev | Home | Next |
JavaScript embedded in Java | Up | JavaScript Image Source URL |
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. |