|
-
Nov 18th, 2003, 12:30 AM
#1
Thread Starter
Member
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
-
Nov 18th, 2003, 05:35 AM
#2
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.
-
Nov 18th, 2003, 12:45 PM
#3
Thread Starter
Member
Thanks, corn I'll see what i can find out about CSS.
-
Nov 18th, 2003, 03:36 PM
#4
Thread Starter
Member
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
-
Nov 19th, 2003, 03:00 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|