In Navigator 3.0 and later, JavaScript code may appear in one additional location in a web page. This is in a JavaScript entity within the value of an attribute of an HTML tag. Recall that an HTML entity is a sequence of characters like < that represents a special character like <. A JavaScript entity is similar. It has the following syntax:
&{ JavaScript-statements };
Whenever an entity is encountered in HTML, it is replaced with its value. The value of a JavaScript entity is the value of the last JavaScript statement or expression within the entity, converted to a string.
In general, entities can be used anywhere within HTML code. The JavaScript entity, however, is restricted to appear only within the value of HTML attributes. These entities allow you to, in effect, write conditional HTML. Typical usages might look like these:
<BODY BGCOLOR="&{favorite_color();};"> <INPUT TYPE="text" NAME="lastname" VALUE="&{defaults.lastname};">
file: /Techref/language/JAVA/SCRIPT/definitive/ch10_05.htm, 4KB, , updated: 2019/10/14 15:00, local time: 2024/11/19 17:42,
3.148.109.73:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/Techref/language/JAVA/SCRIPT/definitive/ch10_05.htm"> [Chapter 10] 10.5 JavaScript Entities</A> |
Did you find what you needed? |