Using Scripts:
(l) When pages utilize scripting languages to display content, or to create
interface elements, the information provided by the script shall be identified
with functional text that can be read by assistive technology.
Javascript is one of the most popular scripting languages for web development.
In addition to libraries of Javascript code available online, two of the
most popular web development tools, FrontPage and Dreamweaver, include easy-to-access
code snippets that add little "extras" to web pages. Developers
should use caution when deciding to include Javascript or other scripting
elements on their pages. Here are a few of the most popular uses for Javascript
and some of the accessibility issues to consider:
- onClick – The onClick event handler is triggered
when the user clicks once on a particular item. It is commonly used on
links and button elements and, used in connection with these elements,
it works well with screen readers. If clicking on the element associated
with the onClick event handler triggers a function or performs some other
action, developers should ensure that the context makes that fact clear
to all users. Do not use the onClick event handlers for form elements that
include several options (e.g. select lists, radio buttons, checkboxes)
unless absolutely necessary.
- onMouseOver and onMouseOut – These two event handlers
are very popular on many web sites. For instance, so-called rollover gif's,
which swap images on a web page when the mouse passes over an image, typically
use both of these event handlers. These event handlers neither can be accessed
by the mouse nor interfere with accessibility – a screen reader simply
bypasses them entirely. Accordingly, web designers who use these event
handlers should be careful to duplicate the information (if any) provided
by these event handlers through other means.
- onChange – This event handler is very commonly
used for triggering JavaScript functions based on a selection from within
a <select> tag. Surprisingly, it presents tremendous accessibility
problems for many commonly used screen readers and should be avoided. Instead,
web developers should use the onClick event handler (associated with a
link or button that is adjacent to a <select> tag) to accomplish
the same functions.
For more information on accessibility issues when using Javascript, see:
See also: Using Time Out Scripts in this tutorial.
Next 
|