Please send questions to
st10@humboldt.edu .
random projected Lecture 4 notes, 8-31-06
* event - an action performed by a web page visitor,
browser, a script, etc.
(moving the mouse over a link, clicking on a button,
submitting a form, loading a web page, etc.!)
* event handler - the mechanism to RESPOND to an event
in a desired way (in our case, with JavaScript statements)
* unfortunately, there is no one standard JavaScript event
model; there are at least 4!
* we're discussing original event model, because it is
supported by all JavaScript-enabled browsers and so
is most portable...
* IN THE ORIGINAL EVENT MODEL...
* there are attributes that are event handlers,
and their values are what happens when the event is handled
* FOR EXAMPLE...js2.html, from the 1st day:
<body> tag has an onload attribute --- its value is
the action to be done when the load event occurs.
(the onload attribute is an event handler...)
* you can HAVE multiple JavaScript statements making up
an event handler attribute's attribute value;
...BUT, you SHOULD separate them with semicolons
HIGHLY RECOMMENDED:
vvvvvvvvvvvvvvvvvv
* BETTER YET -- if you have > 1 JavaScript statement
to do (or even 1 long statement), make those
actions a FUNCTION and CALL that function as the
attribute value!
* so, note that a <body> tag can have event handlers including
onload for handling load events,
onunload for handling unload events,
and more...
* and, note that an <a> tag can have event handlers including
onmouseover for mouseover events,
onmouseout for mouseout events,
and more, I suspect!
* and we'll ADD more events as we get to forms, buttons, objects, etc.