Hotkeys?

They have: 19 posts

Joined: Dec 2003

I'm am putting together a small site that has an emphasis and speed and efficiency. In it, I have a link that goes to the next page.

<a href=http://www.mysite.com/1.php?&id=2 <strong>accesskey=h</strong>>NEXT</a>
'
With the code, when you press "[alt] + h", it will advance to the next page. I want to get to a point where I don't have to press [alt] and just the "h". I know that with Gmail, you can enable hotkeys that allow you to do stuff without pressing [alt]. For example, simply pressing "c" is the same as clicking the "write new message" button.

How can I make it so my hotkeys don't require the [alt]?

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Have you tried looking at the code on the page you say can do this??

-Greg

They have: 19 posts

Joined: Dec 2003

I just did. Unfortunately, it doesn't seem to show how it was done.

Would I use javascript, or html, or what else?

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Can you give an example URL that does this?

-Greg

They have: 19 posts

Joined: Dec 2003

Gmail.com

In the settings, turn on hotkeys, and you can, for example, press "c" to compose a new message. For this you do not need to press the [alt] key. This is what I'm going for and I would appreciate any help to get there.

Thanks Laughing out loud

He has: 26 posts

Joined: Jun 2005

Man, it we can figure this out it would be awesome. I have a few sites that I could use this on. I never thought of trying this out though. I use it on gmail all the time (gotta love the j and the k) we just have to figure out how to do it.

A New Shopping Experience
http://www.wolfrivercountryvillage.com

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

I will take a look this weekend, I'm swamped today and tomorrow preparing and running A/V and printouts for a banquet.

-Greg

They have: 19 posts

Joined: Dec 2003

Put this in the body tag onKeyPress="checkKeycode(event)"'
Put this in the file for the site:

<?php
function checkKeycode(e)
            {
                var
keycode;

                if (
window.event)
                   
keycode = window.event.keyCode;
                else if (
e)
                   
keycode = e.which;
                        if(
keycode==AttandedKeyCodeHere)
                        {
                                               
Code Here
                                               
}

            }
?>

This is supposed to make it work, but I haven't been succusful with it (yet). Anyone know anything about php functions? For some reason, when I add the function above, I get errors for my site...

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Just to clarify, this would be Javascript (client side), not PHP (server side)

-Greg

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.