Re: [TECHS] Use of anchor tags to invoke JavaScript wrote:
> <andrew wrote>
> Why not:
>  <a onclick="doSomething();return false;">Action link</a>
> I don't know what different user agent would do with this.  It is 
> possible that it wouldn't be in the tab order unless a tabindex was also 
> added.  Just a thought...
> </andrew>
> Good idea since href is not a required attribute. But,  as you suggest, 
> the anchor is not in the tab order if there is no href.   Adding the 
> tabindex="0" attribute did not solve the problem since older browsers 
> did not include it in the tab order thus there is no keyboard focus. 

Thinking about it logically, the a element serves two purposes:
* to add a hyperlink to another document or a point inside the same document
* to be a destination for a hyperlink.

The first is accomplished using an href attribute.

The second doesn't and shouldn't by default do anything if activated. 
Its a destination, so using the name attribute gets that done. This has 
largely been superceded with the more modern id attributes on elements.

Trying to put a tabindex on an anchor with no href attribute just 
strikes me as fighting against HTML instead of working within it.


Received on Wednesday, 17 August 2005 18:27:41 UTC