...

View Full Version : Disable F11 keycode



PrathibhaM
07-17-2003, 10:49 AM
Hi,

How do i disable F11 key. I used the below code it works for IE but it does not work for Netscape.


<SCRIPT LANGUAGE="JavaScript">

function onKeyDown() {
if ( (event.altKey) || ((event.keyCode == 8) &&
(event.srcElement.type != "text" &&
event.srcElement.type != "textarea" &&
event.srcElement.type != "password")) ||
((event.ctrlKey) && ((event.keyCode == 82)) ) ||
(event.keyCode == 122) ) {
event.keyCode = 0;
event.returnValue = false;
}
}


</script>
<body onkeydown=onKeyDown()>

</SCRIPT>

Choopernickel
07-17-2003, 02:57 PM
This'll be a start, but be aware: if I wish to browse full-screen and you've disabled it, I'm leaving your site and never coming back.


function onKeyDown(event) {
evt = window.event? window.event : arguments[0];
if ( (evt.altKey) || ((evt.keyCode == 8) && (evt.srcElement.type != "text" && evt.srcElement.type != "textarea" && evt.srcElement.type != "password")) ||
((evt.ctrlKey) && ((evt.keyCode == 82)) ) ||
(evt.keyCode == 122) ) {
evt.keyCode = 0;
evt.returnValue = false;
}
}


This will need other changes, but I'm only helping this amount because you should learn how to handle events in Mozilla, even if AOL did just axe Netscape. The browser ain't going away.

brothercake
07-17-2003, 05:17 PM
Why do you want to disable F11? What will it possibly do except annoy people who don't know to turn your script off?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum