Click to See Complete Forum and Search --> : disable browser function keys


Larrybosch
08-04-2004, 10:17 AM
I am working on a simulation of a software program and want to have the user press the F1 key on the keyboard, I am able to get the keypress but does anyone know away to keep the windows help menu from coming up

Thanks

steelersfan88
08-04-2004, 10:20 AM
F1 is a Windows standard for Help. You should never, ever change that. What's wrong with the F2 key?

BillyRay
08-04-2004, 10:51 AM
I'm not sure if it is possible to stop the F1 key bringing up help. i tried code that would normally work, and it seems that IE just ignores it and brings up the help anyway :(

Dan

steelersfan88
08-04-2004, 11:18 AM
Originally posted by BillyRay
I'm not sure if it is possible to stop the F1 key bringing up help. i tried code that would normally work, and it seems that IE just ignores it and brings up the help anyway :(

Dan and it rightfully should. For those using just keyboards who need to access Help should not have this privelege revoked.

Larrybosch
08-04-2004, 12:36 PM
This will be a training program on an intranet and will not be for the masses because in the software program I am simulating the F1 key brings up a different menu anyways

BillyRay
08-04-2004, 03:26 PM
Got it - at least in IE6:

<html>
<head>
<script type="text/javascript">
<!--
document.onhelp = function() { return(false); }
window.onhelp = function() { return(false); }
//-->
</script>
</head>
<body></body>
</html>

Really only the first one is needed to stop F1, but the window event may be fired by other means, I'm sure.

Hope this helps,
Dan

Larrybosch
08-05-2004, 10:39 AM
thanks! that works, does the other keys like F3 search and F5 refreash have similar function calls and is there any paticluar reference I can find this info?

Thanks again I have been looking all over the place to solve this issue I really apperciate your help

BillyRay
08-05-2004, 10:46 AM
I think for the F3 and/or F5 keys, you'll have to trp the keypress using either document.keydown, keyup, or keypress, and filter out the relevant codes for those keys... Although as with the F1 key, that may not work if IE is using those for its own purposes.

Dan