Events
Events occur when the user does something (although they can also be
'faked' by JavaScript). They can trigger event handlers - JavaScript code
that responds to the event.
This page lists the events we have met on the course (I will be updating it as we go).
onClick
Triggered when the user clicks on an element.
E.g. <a href="#" onClick='alert("You clicked.");' >Click
Here</a>
Click Here
onMouseOver / on MouseOut
Triggered when the mouse moves over an element, or leaves it.
E.g.
<img src="roseNormal.gif"
onMouseOver='this.src="roseHighlight.gif";'
onMouseOut='this.src="roseNormal.gif";' >
onLoad
Can be used in the <img> tag or the <body> tags.
Triggered when the element finishes downloading.
E.g.
<img src="roseNormal.gif" onLoad='ready();' >
For a sophisticated example of using this,
see Implementing a Loading Bar.
Be warned that this is quite a complex example.