Hi, I received a script for making my own acces keys. It works fine BUT it requires the visitor to press only 1 key. This is not handy.. esspecially on a page were you are filling out a form or using a search engine. I want a Key combination of 2 keys. For instance CTRL + y (it doesn't have to be ctrl but that's what I had in mind). Could someone look at the script, and maybe help me by making some ajustments? This is the script: <body onkeypress="if ((document.getElementById)&&(!document.all)){go_dest(event.which)}"> <script type="text/javascript"> keys="hyg" dest=["http://www.htmlforums.com","http://www.yahoo.com", "http://www.google.com"] if (document.layers) document.captureEvents(Event.KEYPRESS) function go_dest(e){ for (i = 0; i < dest.length; i++){ if (document.layers){ if (e.which==keys.charCodeAt(i)) window.location=dest } else if (document.all){ if (event.keyCode==keys.charCodeAt(i)) window.location=dest } else if ((document.getElementById)&&(!document.all)){ if (e==keys.charCodeAt(i)) window.location=dest } } } document.onkeypress=go_dest </script> </body>
You can do something like if (e.modifier().ctrl || e.modifier().meta) { if (e.key().string == 'KEY_Y') { } } Code (markup):