Click to See Complete Forum and Search --> : enabling shortkeys with javascript


Koldewijn
02-12-2003, 07:01 AM
is there a possibility to let javascript scan for certain key combinations, which when pressed set focus to a certain screen-element, such as a link, table cell etc. or even better to be able to create a tab order?

pyro
02-12-2003, 07:20 AM
I think you are looking for the accesskey and taborder properties of HTML. Take a look at the below example:

<a href="one.htm" tabindex="1" accesskey="q">One</a><br/>
<a href="two.htm" tabindex="w" accesskey="b">Two</a><br/>

Link one can be selected now by hitting Alt-Q. One thing to beware: Setting access keys to values used by the browser (Alt-F, etc) will probably cause problems. Also, it isn't reliable in every browser, and I don't think they work at all in Opera.