Whenever a user clicks on a link, or moves her cursor over one,
JavaScript is sent a link event. One link event is called onClick,
and it gets sent whenever someone clicks on a link. Another link
event is called onMouseOver. This one gets sent when
someone moves the cursor over the link.
You can use these events to affect what the user sees on a
page. Here's an example of how to use link events. Try it out,
View Source, and we'll go over it line by line.
The first interesting thing is that there are no <script>
tags. That's because anything that appears in the quotes of an onClick
or an onMouseOver is automatically interpreted as
JavaScript. In fact, because semicolons mark the end of statements
allowing you to write entire JavaScripts in one line, you can fit
an entire JavaScript program between the quotes of an onClick.
It'd be ugly, but you could do it.
Here's the first line of interest: