Creating Usable Javascript Links

As I surf the Web, I come across countless Web sites that use one of the following methods to invoke a javascript function when someone clicks a link:

<a href="javascript:somefunction()">Click to invoke somefunction</a>


<a href="#" onclick="somefunction()">Click to invoke somefunction</a>

Unfortunately, these types of links are completely unusable for anyone with javascript disabled (and, for that matter, the second example is completely useless to people that can’t “click” the links, such as people using older handheld devices). Even worse, the second example can be extremely annoying, as it focuses the screen back to the top of the Web page when you click it.

Why Accessibility Should Be Important To You – A Lesson Learned

Target recently settled a lawsuit for $6 million after being sued by the National Federation of the Blind (NFB). The NFB sued the mega retailer because their Web site was not accessible enough.

While I don’t expect all of us to be sued by advocacy groups, this example does give each of us another reason to begin pushing harder for concrete accessibility guidelines, and to continue working toward making our own Web sites accessible for disabled users.

For those of us in the public sector, accessibility is even more important, as we are actually governed by the SEC 508 guidelines. However, even those in the private sector, as evidenced by this lawsuit, should watch their backs and get with the times.

While there are no real guidelines for accessibility in the private sector, the SEC 508 guidelines and the Web Content Accessibility Guidelines (WCAG) are certainly still good things to strive toward.