| (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. |
When web pages rely on special programming instructions called "scripts" to affect information displayed or to process user input, functional text shall be provided. It also requires that the text be readable by assistive technology such as screen reading software. This provision requires web page authors to ensure that all the information placed on a screen by a script shall be available in a text form to assistive technology.
Pages must be useable when scripts, applets, or other programmatic object are disabled. If the scripts, applets, and other programmatic objects are not accessible even with the browser settings enabled, it is imperative to provide a textual and/or auditory equivalent. An alternative presentation must be available for those impaired users who cannot access the dynamic content.
How can web developers comply with this provision?
Web developers working with JavaScript frequently use
so-called JavaScript URL's as an easy way to invoke JavaScript functions.
Typically, this technique is used as part of <a> anchor links. For
instance, the following link invokes a JavaScript function called myFunction:
<a href="javascript:myFunction();">Start myFunction</a>This technique does not cause accessibility problems for assistive technology.
Some situations to look for :
<a href="javascript:myFunction();"><img src="myFunction.gif"></a>
This type of link, as written, presents tremendous accessibility problems, but those problems can easily be remedied. The <img> tag, of course, supports the "alt" attribute that can also be used to describe the image and the effect of clicking on the link. Thus, the following revision remedies the accessibility problems created in the previous example:
<a href="javascript:myFunction();"> <img src="myFunction.gif" alt="picture link for starting myFunction"></a>
<a title="this link starts myFunction" href="javascript:myFunction();"><img src="myFunction.gif"></a>This tag is supported by some but not all assistive technologies. Therefore, while it is part of the HTML 4.0 specifications, authors should use the "alt" tag in the enclosed image.
<a href="javascript:myFcn();" onmouseover="status='Nice Choice'; return true;" onmouseout="status='';"><img src="pix.gif"></a>This text rewritten into the status line is difficult or impossible to detect with a screen reader. Although rewriting the status line did not interfere with the accessibility or inaccessibility of the JavaScript URL, web developers should ensure that all important information conveyed in the status line also be provided through the "alt" attribute, as described above.
JavaScript uses so-called "event handlers" as a trigger for certain actions or functions to occur. For instance, a web developer may embed a JavaScript function in a web page that automatically checks the content of a form for completeness or accuracy. An event handler associated with a "submit" button can be used to trigger the function before the form is actually submitted to the server for processing. The advantage for the government agency is that it saves government resources by not requiring the government's server to do the initial checking. The advantage for the computer user is that feedback about errors is almost instantaneous because the user is told about the error before the information is even submitted over the Internet.
Web developers must exercise some caution when deciding which event handlers to use in their web pages, because different screen readers provide different degrees of support for different event handlers. The following table includes recommendations for using many of the more popular event handlers:
Sample Code
<SCRIPT LANGUAGE = "JavaScript">
<!-- var isIMG = document.images; var bon; var boff; if (isIMG) { bon = new Image(); boff = new Image(); bon.src = 'Images/on.gif'; boff.src = 'Images/off.gif'; } function b(bname) { if (isIMG) { document[bname].src = (document[bname].src.indexOf('Images/on.gif') != -1) ? 'Images/off.gif' : 'Images/on.gif'; } } //--> </SCRIPT> <NOSCRIPT> This is a rollover script that makes a red arrow appear to the left of a primary link item when the cursor is placed over the link. As the cursor leaves an option, the red arrow is replaced with a blank graphic. </NOSCRIPT>
Working Example
|
|
|
Previous Slide |
First Slide |
Next Slide |