General discussion

Locked

Enter key for A tag

By jamlove ·
Is there anyway that if i press the ENTER key it should call the onclick Event of the Anchor tag?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Enter key for A tag

by cal In reply to Enter key for A tag

Yes, sort of.

In the code below, I've created a sample. It's not foolproof and it will break if you tinker too much with it but it should point you in the right direction.

Cal

*
* Cal Evans
* Professional Nerd Herder
* http://www.calevans.com
*

(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN")

(html)
(head)
(title)Click Test(/title)
(script language="JavaScript")
function load(){
// gives the button focus
document.all.TestMe.focus();
}
(/script)(/head)

(body onLoad="load();")
(a href="http://www.calevans.com")Test Link(/a)(BR)
(input type="button" name="TestMe" onclick="window.location = document.links[0].href" value="Press Enter")


(/body)
(/html)

Collapse -

Enter key for A tag

by jamlove In reply to Enter key for A tag

The question was auto-closed by TechRepublic

Collapse -

Enter key for A tag

by James_Randy In reply to Enter key for A tag

The first answer looks good to me. If that doesn't work, try something else. Hope this helps.

Collapse -

Enter key for A tag

by jamlove In reply to Enter key for A tag

The question was auto-closed by TechRepublic

Collapse -

Enter key for A tag

by jamlove In reply to Enter key for A tag

This question was auto closed due to inactivity

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums