W3CWeb Accessibility Initiative Home

ONCLICK and ONDBCLICK

On this page: Test 1 | Test 2 | Test 3 | References | About these tests

Nearby: More HTML 4.01 Tests | UAAG 1.0 Test Suite

UAAG 1.0 Requirement

Checkpoint 1.2 Activate event handlers (Priority 1 )
Provision 1 : Allow the user to activate, through keyboard input alone, all input device event handlers that are explicitly associated with the element designated by the content focus.

Test 1 :

Procedure

  1. Using the keyboard or an assistive technology that emulates the keyboard, navigate to the image and activate the ONCLICK event and the ONDBLCLICK event.

Run test

star

Expected results

  1. Image changes to a red star on single-click keyboard command
  2. Image changes to a pink star on double-click keyboard command

Source code

<p>
  <img id="star1" ondblclick="imgChange('../images/starPink.gif')" onclick="imgChange('../images/starRed.gif')" src="../images/starYel.gif" width="35" height="35" alt="star" border="0" name="star1"></img>
</p>

Test Script Code

function imgChange( img ) { document.star1.src = img }

Test 2 :

Procedure

  1. Using the keyboard or an assistive technology that emulates the keyboard, navigate to the text input box.
  2. Using the keyboard or an assistive technology that emulates the keyboard, clear the text input box with ONCLICK.

Run test

Expected results

  1. Text in input box is cleared

Source code

<form action="../action/return.html" method="get" enctype="application/x-www-form-urlencoded">
  <input onclick="clearText(this)" value="Click here to clear text" name="text1" type="text"></input>
</form>

Test Script Code

function clearText(thefield) { if (thefield.defaultValue == thefield.value) thefield.value = "" else thefield.value = thefield.defaultValue }

Test 3 :

Procedure

  1. Using the keyboard or an assistive technology that emulates the keyboard, navigate to the text input box.
  2. Using the keyboard or an assistive technology that emulates the keyboard, activate the ONDBLCLICK function associated with the text input box.

Run test

Expected results

  1. The text "Passes the Test" appears in the text box upon double-click

Source code

<form action="../action/return.html" method="get" enctype="application/x-www-form-urlencoded">
  <label for="text1">Double-click on the text box to show the message: </label>
  <input id="text1" ondblclick="showText(this)" name="text1" type="text"></input>
</form>

Test Script Code

function showText(thefield) { if (thefield.defaultValue == thefield.value) thefield.value = "Passed the test" else thefield.value = "" }

References

  1. HTML 4.01 specification for ONCLICK
  2. HTML 4.01 specification for ONDBCLICK

About this test suite

This test is part of a test suite for the User Agent Accessibility Guidelines (UAAG) 1.0 . This work is conducted by the User Agent Accessibility Guidelines Working Group , which is part of W3C's Web Accessibility Initiative (WAI) . Please send comments on this test to w3c-wai-ua@w3.org ( public archive ).


Test created by:

Last modified: $Date: 2003/04/02 23:46:28 $ by $Author: jongund $