...

View Full Version : how to add shift to this script



yombull
03-18-2004, 08:12 PM
I created a script to navigate using the f keys, but I need it to include shift + F1 here and I could only figure out how to do this using only the F1 key. Can anyone show me how to make this script to where the user has to use shift + F1:

<script>
function handleKeyPress(evt) {
var nbr, chr;
if (window.Event) nbr = evt.which;
else nbr = event.keyCode;
//Opens Link with Shift-F1
if(nbr==112){document.location.href="pap09.html";}
else{return true;}
}
document.onkeydown= handleKeyPress
</script>

Roy Sinclair
03-18-2004, 08:44 PM
That key is reserved for the help function and cannot be overriden by any web page.

yombull
03-18-2004, 09:06 PM
Okay, how could I do the same thing using shift + u? instead of F1

Roy Sinclair
03-18-2004, 09:48 PM
Look in the "Post a Javascript" forum here and you'll find a recently posted script which you can use to find the keycode of any key. With that you can set up your capture to watch for that particular keycode.

glenngv
03-19-2004, 05:37 AM
The link "Key Events" in my sig leads to a page that might give you the idea on detecting modifier keys such as SHIFT, ALT and CTRL.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum