![]() |
|
![]() | ||
|
Subject:
Hotkeys on my website
Category: Computers > Internet Asked by: usefulcat-ga List Price: $4.50 |
Posted:
05 Dec 2002 14:07 PST
Expires: 07 Dec 2002 08:09 PST Question ID: 119942 |
I'm constructing a website for my dissertation and I wish to allow the users to be able to navigate through it using hotkeys. For example: CTRL-H takes them to the home page CTRL-S submits a completed form ALT-X allows them to log out Something along these sorts of lines. The site will be using Perl Scripts. I know that the browsers have their own hot keys, for example Netscape lets you navigate visited pages backwards and forwards with ALT-left arrow and ALT-right arrow. I want to identify hot-keys specifically for my site though, not generic ones coded into the browser. Can this be done, and if so how? Thanks for your help, UsefulCat | |
|
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: Hotkeys on my website
From: darthcow-ga on 05 Dec 2002 20:52 PST |
The easiest way is to add accesskey="h" on the link to your homepage, accesskey="s" on the submit button for the form, accesskey="x" on the link to logout. This will allow a user to type ALT+H to go to your homepage, or whatever. Anything beyond that (e.g. using Ctrl instead of Alt) will require some complex and annoying javascript. Just be certain you aren't overwriting any default browser behaviors, or that could be frustrating for your visiters. |
Subject:
Re: Hotkeys on my website
From: sun818-ga on 06 Dec 2002 15:40 PST |
Take a look at Noah Grey's Greymatter news publishing script. He utilizes the hotkeys for some of news administration functions. |
Subject:
Re: Hotkeys on my website
From: lot-ga on 06 Dec 2002 17:50 PST |
accesskey is quite cool! Though doesn't work for Mac (if that's important) I was thinking something in javascript like 'keycompare' using the ASCII keyboard number and if matches key in the script to execute an action. Unfortunately I'm not a javascript expert, so it's only a bit of a brainstorm. regards lot-ga |
Subject:
Re: Hotkeys on my website
From: darthcow-ga on 06 Dec 2002 23:43 PST |
Take a look at http://www.stephanhoyer.com/keycode.html There I put up a page that I know works with IE 6, but probably for any other recent (5+) IE browser as well. When you do a "keydown", it reveals the number for the last key down. When you do a "keypress", generally pressing a key with Ctrl, it reveals that as well. If you look at the code (it's in JavaScript), you'll notice the keyPressTrigers and keyPressActions array variables defined. These variables allow you to define javascript actions for when a certain key is pressed. Along with location.href as used in the example, you can use 'formname.submit()' to submit a form and 'formname.reset()' to reset a form. You'll want to copy all the code with the <script></script> tags and remove the lines with innerHTML in them to use the code on your site. I can't offer any guarentees, but it should work if your visiters are using newer browsers (and probably windows will be required too). |
Subject:
Re: Hotkeys on my website
From: lot-ga on 07 Dec 2002 04:30 PST |
darthcow-ga's latest implementation works with Macs as well :-) I found a solution that works with single key presses but thought it might be an issue if people are entering data into a form (typing form data would set off the hot key accidently and send users whizzing to a different URL), but darthcow-ga's solution works with Control + key combination too. regards lot-ga |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |