HTML and CSS Reference
Now that you have added user-defined functions to count down to a certain date, changed
the scroll bar color, used a drop-down menu, and added the date last modified at the
bottom of the page, you need to add code that calls these functions when the Web page is
is to use event handlers and object methods. The other method is to code the function
written in this chapter execute using event handlers.
As you have learned, an event is the result of an action, such as a mouse click or a
window loading. An event handler is a way to associate that action with a function. For
may be associated with that event. The associated function will execute if the event is
form of an event handler is shown in Table 9-29.
Table 9-29 Event Handlers
where tag is the HTML tag; attribute is a property of the tag that can have a value assigned to it,
execute, usually in the form of a function name
Quick Reference in Appendix G. You use the onLoad and onChange event handlers in the
Midwest Bridal Expo Web page.
use the onLoad event. The onLoad event handler triggers the associated function when
the Web page has completed loading into the browser. The onChange event handler
triggers when the value of an object changes. For example, when the user selects a list
item in the select list, the value of the select list is changed.
To Associate User-Defined Functions with the OnLoad Event
defined functions with the onLoad event.
Click to the right of
the y in the <body>
tag in line 78, as
shown in Figure 9-14.
insertion point in <body> tag;
press SPACEBAR once to begin
adding onLoad event handler