hyperlink that uses the enter key

R

rf

harold said:
hi guys,
How can i create a hyperlink that also activates with the enter
key?

Press the tab key until the link is focused.

Press enter.

Cheers
Richard.
 
R

rf

[upsidedown posting corrected]
hi richard,
that's not quite what i'm after but thanks for your help
anyway
Oh I knew exactly what you were after. I was trying to point out that using
the enter key to activate a link is a *user* action, not an *author* action.

It would be rather simple to use javascript to hook the enter keys onkeydown
event and cause it to do something diferent. However what if I, as a user,
wish to use the above key sequence? Remember, I may not be able to use a
mouse. When I press enter instead of the link I have laborously tabbed to
firing a totally different one does. Your site becomes unnavigable to a
keyboard user.I also might have typed another address into the address bar
and pressed enter. Your link fires, not the one I wish to go to.

You might be deemed to be intentionally discriminating against certain
disabled people which, as you must know, can be illegal in Australia :)

Cheers
Richard.
 
H

harold

hi richard
i'm looking at a simple web style training booklet to show the
elderly how to do a certain action and prior to learning the mouse i would
like them to be able to enter the next page by just pressing enter.



rf said:
[upsidedown posting corrected]
hi richard,
that's not quite what i'm after but thanks for your help
anyway
Oh I knew exactly what you were after. I was trying to point out that using
the enter key to activate a link is a *user* action, not an *author* action.

It would be rather simple to use javascript to hook the enter keys onkeydown
event and cause it to do something diferent. However what if I, as a user,
wish to use the above key sequence? Remember, I may not be able to use a
mouse. When I press enter instead of the link I have laborously tabbed to
firing a totally different one does. Your site becomes unnavigable to a
keyboard user.I also might have typed another address into the address bar
and pressed enter. Your link fires, not the one I wish to go to.

You might be deemed to be intentionally discriminating against certain
disabled people which, as you must know, can be illegal in Australia :)

Cheers
Richard.
 
L

Leif K-Brooks

harold said:
i'm looking at a simple web style training booklet to show the
elderly how to do a certain action and prior to learning the mouse i would
like them to be able to enter the next page by just pressing enter.

Are you sure this should really be an HTML page? Sounds like it would be
better as a fullscreen GUI application.
 
C

Chris Morris

Ryan Stewart said:
How about a submit button? That's automatically triggered by enter.
Something like this:

<input type="submit" onclick="location.href='www.w3schools.com';">

It's only automatically triggered _in some browsers_ if any part of
the form has focus. And what's the onclick for? (I know what it does,
I just can't see why you need it there)
 
T

Toby A Inkster

harold said:
i'm looking at a simple web style training booklet to show the
elderly how to do a certain action and prior to learning the mouse i would
like them to be able to enter the next page by just pressing enter.

Well, not quite what you want, but if you get these people to use Opera 7
as their browser, they can automatically move on to the next page using
space bar if you use this code somewhere between <head> and </head>:

<link rel="next" href="nextpage.html">
 
R

Ryan Stewart

Chris Morris said:
It's only automatically triggered _in some browsers_ if any part of
the form has focus. And what's the onclick for? (I know what it does,
I just can't see why you need it there)
You'll have to forgive me. My limited html development experience is all
with IE. As for the onclick, how else does it know where to go if it isn't
part of a form and you don't specify an onclick?
 
S

Steve Pugh

Ryan Stewart said:
You'll have to forgive me. My limited html development experience is all
with IE. As for the onclick, how else does it know where to go if it isn't
part of a form and you don't specify an onclick?

Netscape 4, for example, will not display input elements unless they
are inside a form element. Having input elements on their own is
risky.

<form method="get" action="http://www.example.com/">
<input type="submit">
</form>

will work just the same as your onclick version but will also work
when JavaScript isn't enabled.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top