Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript code?

Status
Not open for further replies.

cc5305

MIS
Oct 4, 2000
70
US
Hi, I'm pretty new working with Javascripts. I have two buttons on my site. And what I want to do is to have the code behind one of the buttons executed when the user press the Enter key on their keyboard. How can I do that? Thanks for your help.
 
Try this:

Code:
<script>
function funcdown{
if(window.event.keyCode == 13){
alert(&quot;Here come's you script&quot;)
}
}
document.onkeydown = funcdown;
</script>
My site: msn/email: matthiasdeschagt@hotmail.com
icq: 123118841
online
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top