Aside, while it may be convenient to embed javascript in HTML tags by way of illustration, let me reiterate the oft-made point that doing so in practice is a mistake, for at least these two reasons:
1) User agents that don't support the scripting language or any of the functions used in the script will throw an untrappable error. Better to apply behavior to objects on the page from a safe distance whereby nothing occurs when the script is unsupported. The most common way to do this is to engage an initialization script with the window.onload event which checks specifically for support before adding behavior to objects on the page.
2) Separating content (HTML markup) from behavior (script) from style (CSS) is A Good Thing because modular software is easier to maintain, and because old, cranky, or idiosyncratic browsers can more easily be protected from components they don't support.
I would therefore mark up that tag (uniquely identified so a script can find it easily) simply as:
<a id="unique123" href="whatever.com">Whatever.com</a> or: <div id="unique123"> <a href="whatever.com">Whatever.com</a> </div>
and apply the behaviors separately from a linked script.
Paul;
Interesting solution you have come up with here, however, thinking validation versus functionality here, this is the same idea of a 'catch-all' handling, however, I am not sure that your script linked to this can give both on-click and on key press to the user can it?
If so I would love to see an example of your code, or even better in a working page somewhere :)
Regards
~Veine
Veine K Vikberg http://www.vikberg.net Professional Web Guru
