Accesskey Underlining Library

The Accesskey Underlining Library, or AUL, is a small library which automatically underlines accesskeys in labels, legends and so on.

It was written for two reasons. The first is to be useful - if you have a localised web application, you don't know what the accesskeys are going to be for a particular language, and you don't want to start scattering <u>s in your localisable strings file. Secondly, though, it's a small demonstration of two important techniques in JavaScript use.

The first is unobtrusive JavaScript. In summary, it means that all one should have to do to use a script is to include it in a <script src="">. The script will do all the work of analysing the page, registering event handlers and performing necessary tasks to enhance the page. It should do its job with nothing else required.

The second is the separation of content and presentation, which is an important principle of modern web design. A change like the underlining of accesskey letters, or e.g. the addition of curvy corners, is basically presentational and should therefore really be controlled from the presentation layer, i.e. CSS. The underlining may be inappropriate for some circumstances, such as when printing, and so should be able to be turned off in the print stylesheet.

Please read the comments in the script to see how to include it, and how to use CSS to turn the effect on and off.

Download script | test page

Original URL: http://www.gerv.net/software/aul/