htmlaccess-keys

HTML element keyboard shortcut without alt key


I have a button that is accessed by a keyboard shortcut but the users have to press ALT+Z. Is there anyway to let the users access the button by simply pressing Z (or some other key) without having to press ALT?

Many thanks,

<input style="display:none;" id='stopButton1' type="button" value="Z" onclick="stop('z')" accesskey="z" />

Solution

  • No that is not possible in pure HTML.

    JavaScript is needed: Use the keypress event to detect specific character codes, and call some function.