bounzer
08-20-2003, 08:40 AM
how can i get a keycode of a key that been pressed and called onkeydown event handler?
|
Click to See Complete Forum and Search --> : what key is pressed and called onkeydown event? bounzer 08-20-2003, 08:40 AM how can i get a keycode of a key that been pressed and called onkeydown event handler? pyro 08-20-2003, 09:11 AM Take a look at this tool: http://www.infinitypages.com/research/keycode.htm bounzer 08-20-2003, 09:41 AM thanks a lot! nice site you've suggested. pyro 08-20-2003, 09:49 AM You bet... Glad you like the site... :) bounzer 08-20-2003, 10:59 AM oh, i've not notices it's your site :D there are some useful scripts for me i've found on it. there is another little question i have about this keyDowns. if i'll do my own "ctrl+s" key combination pressed event handler, will browser let my script catch it or he processes all this hot combinations itself? pyro 08-20-2003, 12:24 PM This probably isn't the prettiest way to do it, but it should work fairly well... <script type="text/javascript"> ctrl = 0; function whichKey(e) { if (window.event) { code = event.keyCode } else { code = e.which; } if (code == 17) { ctrl = 1; } if (code == 83) { if (ctrl == 1) { alert ("Ctrl + s was pushed"); } } if (code != 17) { ctrl = 0; } } document.onkeydown = whichKey; </script> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |