HTML and CSS Reference
In-Depth Information
pops up an alert dialog box and does nothing else. The document con-
taining the hyperlink is still visible after the dialog box is displayed and
dismissed by the user.
12.3.5. JavaScript Entities
Character entities in HTML and XHTML consist of an ampersand ( & ), an
entity name or number, and a closing semicolon. For instance, to insert
the ampersand character itself in a document text flow, use the char-
acter sequence & . Similarly, JavaScript entities consist of an am-
persand, one or more JavaScript statements enclosed in curly braces,
and a closing semicolon. For example:
&{document.fgColor};
You must separate multiple statements by semicolons within the curly
braces. The value of the last (or only) statement is converted to a string
and replaces the entity in the document.
Normally, entities can appear anywhere in a document. JavaScript en-
tities, however, are restricted to values of tag attributes. This lets you
write "dynamic tags" whose attributes are not known until the document
is loaded and the JavaScript is executed. For example, this tag sets the
text color of the document to the color value returned by the individual's
favorite_color() function:
<body text=&{favorite_color()};>
Support for JavaScript entities is inconsistent among the various
browsers and for this reason we recommend against their use.
 
Search WWH ::




Custom Search