Java Reference
In-Depth Information
<tag eventHandler=”JavaScript code”>
Event handlers can be combined with attributes in a tag. The JavaScript code to
execute normally is in the form of a function call, although not exclusively.
The <body> tag on line 31 in Figure 12-7 on page 787 contains both a text
attribute and an event handler. The text attribute sets the text color to a value,
expressed as three hexadecimal (base-16) numbers representing the red, green,
and blue (RGB) values in the color. These values range from 00 to FF, for 256
different values each, to allow you to specify a color value from #000000 (black)
to #FFFFFF (white). Standard colors, such as those listed in Table 12-5, also may
be referenced by their name, as in white, blue, red, black, and so on.
Table 12-5
Standard Color Names and RGB Values
COLOR
NAME
RGB VALUE
Aqua
#00FFFF
Black
#000000
Blue
#0000FF
Fuchsia
#FF00FF
Gray
#808080
Green
#008000
Lime
#00FF00
Maroon
#800000
Navy
#000080
Olive
#808000
Purple
#800080
Red
#FF0000
Silver
#C0C0C0
Teal
#008080
White
#FFFFFF
Yellow
#FFFF00
The event handler, the onLoad() method , executes when the document
is loaded by the browser. In this case, the onLoad() method calls the focus()
method for the field, userID, in the form, logonScreen, of the current document.
The focus() method thus places the insertion point in the userID text box.
The <hr> tag in line 32 indicates that a horizontal rule, or line, will display
on the page, above a three-column table used to position elements on the Web
page. The table is defined using the table tag (<table>) in line 33; each row in the
table is defined using a row tag (<tr>). Within each row are column tags (<td>)
 
Search WWH ::




Custom Search