Click to See Complete Forum and Search --> : hotkeys....
xataku_nakusute
07-29-2003, 04:08 AM
excuse me, but do any of you know how to set certain hotkeys for certain links/pages?
if so, how do you identify the keyboard key with its numerical value?(unless this is not applicable)
AdamGundry
07-29-2003, 04:37 AM
Do you mean an accesskey (http://www.w3.org/TR/html401/interact/forms.html#adef-accesskey)?
Adam
xataku_nakusute
07-29-2003, 04:51 AM
ok, ic now.....however, 2 q's....
1) the examples on the page show capital letters......does that mean itll work only if you hold shift?
2) how would you use the accesskey to run internal scripts?
AdamGundry
07-29-2003, 09:29 AM
1. You don't have to hold shift, but you may need to hold alt to get your browser to look for the accesskey.
2. I don't think you can do that with accesskeys, but you can using Javascript and the onkeydown (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/handlers.html#1120313), onkeypress (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/handlers.html#1120393) and onkeyup (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/handlers.html#1120473) event handlers.
Adam
xataku_nakusute
07-29-2003, 07:40 PM
thanx.....so if i had a link that when clicked on, triggered a script, would that basically trigger the script when i used the defined accesskey?
AdamGundry
07-30-2003, 02:19 AM
Yes, I guess you could use one of these:
<a href="javascript:alert('You pressed alt+A.')" accesskey="A">Link</a>
<a href="#" onclick="alert('You pressed alt+A.')" accesskey="A">Link</a>
The first should work (I think), the second might, but the second is probably a better idea if it works because it doesn't break for non-JS browsers.
Adam