W3CWeb Accessibility Initiative Home

ONFOCUS and ONBLUR attributes for LABEL elements

On this page: Test 1 | 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, move focus to the input control label to trigger the onFocus event.
  2. Using the keyboard or an assistive technology that emulates the keyboard, move focus off the input control label to trigger the onBlur event.

Run test

red star

Expected results

  1. A red star appears in the box when the input button label receives focus.
  2. The red star disappears when the input button label loses focus.

Source code

<table summary="layout table">
  <tbody>
    <tr>
      <td rowspan="1" colspan="1">
        <form action="../action/return.html" method="post" enctype="application/x-www-form-urlencoded">
          <label onblur="blurTest('../images/clear.gif')" onfocus="focusTest('../images/starRed.gif')" for="button1"> Label for test button: </label>
          <button id="button1" name="button1" type="submit">Test</button>
        </form>
      </td>
      <td rowspan="1" colspan="1">
        <table border="1">
          <tbody>
            <tr>
              <td rowspan="1" colspan="1">
                <img id="redStar" height="35" alt="red star" src="../images/clear.gif" width="35" border="0" name="redStar"></img>
              </td>
            </tr>
          </tbody>
        </table>
      </td>
    </tr>
  </tbody>
</table>

Test Script Code

function focusTest (img) { document.redStar.src = img } function blurTest (img) { document.redStar.src = img }

References

  1. HTML 4.01 specification for ONFOCUS
  2. HTML 4.01 specification for ONBLUR
  3. HTML 4.01 specification for LABEL

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 $