Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accesskey activation

Status
Not open for further replies.

ronsig

Programmer
May 24, 2001
54
IL
Hi,

I'm using the "accesskey" attribute for buttons/links, but the hot keys only set the focus on the button/link.

How can I make them actually fire the button's callback function?
e.g
<button accesskey=&quot;t&quot; onclick=&quot;alert();&quot;><u>T</u>est
</button>

<a accesskey=&quot;x&quot; href=&quot;
pressing Alt+T only sets focus to the button
pressing Alt+X sets focus to the link (without navigation)

any way to do this?

10x
Ron
 
The button worked for me in both mozilla and IE 5...
The href did not so I put some onkeyup code in like so:

<button accesskey=&quot;t&quot; onclick=&quot;alert();&quot;><u>T</u>est
</button>

<a accesskey=&quot;x&quot; onKeyUp=&quot;this.click();&quot; href=&quot;
 
Yes, the button works for me too now (can't figure out why it didn't before)

there's a problem with your suggestion for the link: if the user merelty tabs through the items on the page, it'll activate the link!
 
You should probebly check if the keyup was the x key.


<button accesskey=&quot;t&quot; onclick=&quot;alert();&quot;><u>T</u>est
</button>

<a accesskey=&quot;x&quot; onKeyUp=&quot;if(document.all){e=window.event;}var inttmp = 0;if(e.keyCode==88){this.click();}&quot; href=&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top