bganoush
asked on
Simulate click in link with a key stroke...
Hello World!
I have a page that contains a dynamic anchor link and image and I would like the user to be able to press enter to automatically follow that link. I was able to do this but I'm not sure if this is the right solution. I guess my question is ... Is this the only or best way to simulate a click with a key stroke?
Here is what I have so far:
<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
function DoKeyPress()
{
if (event.keyCode== 13)
{
//Submit Anchor link...
var elem = document.getElementById('m ylink');
window.location = elem;
}
}
</SCRIPT>
</HEAD>
<BODY onload="document.onkeypres s=DoKeyPre ss;">
<H1>This is a test</H1>
<A id=mylink href="http://www.yahoo.com"><IMG src="mylinkimage.gif"></A> <BR>
</BODY>
</HTML>
-- Bubba
I have a page that contains a dynamic anchor link and image and I would like the user to be able to press enter to automatically follow that link. I was able to do this but I'm not sure if this is the right solution. I guess my question is ... Is this the only or best way to simulate a click with a key stroke?
Here is what I have so far:
<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
function DoKeyPress()
{
if (event.keyCode== 13)
{
//Submit Anchor link...
var elem = document.getElementById('m
window.location = elem;
}
}
</SCRIPT>
</HEAD>
<BODY onload="document.onkeypres
<H1>This is a test</H1>
<A id=mylink href="http://www.yahoo.com"><IMG src="mylinkimage.gif"></A>
</BODY>
</HTML>
-- Bubba
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your welcome.
S_D
ASKER
Thanks,
We don't support Firefox here but it's good to have a complete solution.
-- Bubba