Example for Checkpoint
Example 2: Use more than one device-dependent event handler to "cover all the bases": ONCLICK requires a mouse event, while ONKEYPRESS requires a keyboard event. Both are device dependent, but including both should allow anyone to benefit from the technique.
Another "script-activated button": click on it, or tab to it and press any key to activate the script. A small alert box should pop up containing a message about the prize. Pressing the Escape key will make it go away.
Here is the code that creates the button:
And here is the code for the script function:
Finally, do not write event handlers that rely on mouse coordinates since this prevents device-independent input.