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 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to add shift to this script

    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>

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That key is reserved for the help function and cannot be overriden by any web page.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, how could I do the same thing using shift + u? instead of F1

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    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.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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