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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem disabling the browser-help on F1 key press

    In the following code in Internet Explorer I am trying to disable the browser-specific help and launch a pop-up window on F1 key press. The pop-up window alone launches when I press F1. If the pop-up window is now minimised and I press on F1 again, the pop-up window comes to focus. But if the pop-up window is on focus and I press F1 again, the browser-specific help is launched. How do I prevent this?

    <script language = "javascript">
    function dispHelp(){

    var keyCode = event.keyCode;
    if(keyCode == 112){

    features="height=400,width=700,status=yes,location=no,top=200,left=200";
    winId = window.open( "http://www.yahoo.com", 'appHelp', features );
    winId.focus();
    return false;
    }

    }

    function disableDefault(){
    event.returnValue = false;
    return false;
    }

    </script>

    <body onkeydown="dispHelp();" onhelp="disableDefault();">

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    But, what if your visitor wanted to use the browser help?
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    You can capture any key, with some crossbrowser effort (and do something meanwile), but, for some of them, or combination of, you can not stop afterwards their default action. F1 is one of them, along, for instance (small list for Windows based OS) F5, ALT-F4, ESC, CTRL-ALT-DEL .... and so on... these are Operating System controled, thus there is nothing you can do to stop them.

    Anyway... Why to change a well-known action of a wellknown key? This is nonsense, in my oppinion.
    Last edited by Kor; 11-09-2006 at 06:24 AM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    New Coder
    Join Date
    Nov 2006
    Location
    Bristol, UK
    Posts
    85
    Thanks
    6
    Thanked 6 Times in 6 Posts
    It's not anything to do with the fact that you're not pulling the same F1 grab code into the popup is it?

    If you're popping up a new window and not resetting the F1 funcionality then it'll act like a regular window's F1 key.

    I dunno...


  •  

    Posting Permissions

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