Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable F11 keycode

    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>

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Code:
    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.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why do you want to disable F11? What will it possibly do except annoy people who don't know to turn your script off?
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •