Results 1 to 5 of 5

Thread: Java Keyboard Shortcuts

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    here and their
    Posts
    35

    Java Keyboard Shortcuts

    I've been trying to find a way to use keyboard commands on my website and though I did find information I have had no luck in getting to work. I tried reading some java tutorials, but I've had no luck.
    Here is my original code, plus the key i was trying to use with it.
    <A HREF="C2.HTML"><IMG SRC="BACK.GIF" ALIGN="LEFT" TARGET="MAIN" ALT="BACK"> (Left Arrow)
    <A HREF="02.HTML"><IMG SRC="NEXT.GIF" ALIGN="RIGHT" TARGET="MAIN" ALT="NEXT"> (Right Arrow)
    <A HREF="INDEX.HTML"><IMG SRC="INDEX.GIF" ALIGN="CENTER" TARGET="MAIN" ALT="INDEX"> (Home)
    Also i've been trying to find a way to create a keyboard shortcut (spacebar) that will allow me to toggle the side bar on my website.

    Here is some information I found.
    http://www.vbforums.com/showthread.p...=java+keyboard
    http://www.vbforums.com/showthread.p...=java+keyboard
    ITs out their

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You want JavaScript, not Java.

    Or CSS, there's a way to specify shortcuts with CSS.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    here and their
    Posts
    35
    Thanks, corn I'll see what i can find out about CSS.
    ITs out their

  4. #4

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    here and their
    Posts
    35
    Well I got this far
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    var key = new Array();  
    key['w'] = "index.html";
    key['a'] = "c2.html";
    key['d'] = "02.html";
    function getKey(keyStroke) {
    isNetscape=(document.layers);
    eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
    which = String.fromCharCode(eventChooser).toLowerCase();
    for (var i in key) if (which == i) window.location = key[i];
    }
    document.onkeypress = getKey;
    </script>
    My question is that what would the key code for the spacebar and the arrow keys be, or is that because these keys are used in IE they are unavilable for JavaScript.
    Also would it be possible to, instead of defining a link, direct it to a preexisting link in the html.
    Last edited by Swatpup32; Nov 18th, 2003 at 03:40 PM.
    ITs out their

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Arrow keys are available somehow, but I can't remember how.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width