HTML and CSS Reference
In-Depth Information
EXPLANATION ( CONTINUED )
6, 7
These are the functions that are called when the mouse events are triggered.
8
The HTML <a> tag is given an id of “link1” and assigned an initial image. The out-
put is shown in Figure 13.46.
Figure 13.46 Mouse rolls over first baby. Image is replaced with second baby.
13.9 What You Should Know
The day the music died ... the day events died, is when JavaScript ceased to exist. It
would be a challenge to find a JavaScript program that doesn't have an event handler.
Events are the basis for interactivity and without them, a Web page is dead. This chapter
focused on all the major event handlers you can use in JavaScript, what triggers them,
and how to register them. We saw that event handlers can be assigned to objects such as
buttons, links, windows, and forms and that when a user rolls the mouse over an object,
clicks a button, presses a key, resizes the window, submits a form, or changes a value,
JavaScript can react and do something based on those actions. The simplest way to use
the handlers is as attributes of HTML tags, but in doing so, JavaScript is made part of the
HTML markup. To keep the structure (markup) and the behavior (JavaScript) separate,
the event handlers can be used as properties of objects. In Chapter 15, we will take this
to the next level, working with event handlers and the DOM. So far, you should know:
1. How to create an inline event handler.
2. What it means to register an event.
3. When the return value from the event handling function is necessary.
4. How to use JavaScript event methods.
5. How the onblur and onfocus event handlers are used.
6. What event handlers are used with windows and frames.
 
 
Search WWH ::




Custom Search