Example for Checkpoint
9.3, continued.

Example
Slide 71 of 120
Previous slide. Next slide.

The following examples can only be fully appreciated if your browser supports JavaScript (and you have enabled scripts to be run). Your browser must also support the BUTTON element.

Example 1: Use a device independent event handler that works with any appropriate input action: in this case, ONFOCUS works with both a keyboard event and a mouse event, so it is considered to be a device independent event handler.

The example is the "script activated button": try clicking on it or tabbing to it. A small alert box should pop up containing a message about the prize. Pressing the Escape key will make it go away.

And here is the code that creates it:

<BUTTON onfocus="pop1()"> Win a prize!</BUTTON>.

And here is the script that does the work:

<SCRIPT language="JavaScript" type="text/javascript">
function pop1() { alert ("First Prize!") }
</SCRIPT>
<NOSCRIPT>First Prize!</NOSCRIPT>


Up one level To Checkpoints for Guideline 9.
Next slide: Example for Checkpoint 9.3 continues

Introduction: Overview Guidelines: Overview Checkpoints: Overview Examples: Overview

Previous page. Next page.

Chuck Letourneau & Geoff Freed

W3C Web Accessibility Initiative

Copyright © 2000 W3C