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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Enter Key to process function

Status
Not open for further replies.

Skark166

IS-IT--Management
Aug 6, 2002
54
US
Hey all,

I have a basic form with four text fields and a submit button. When you click the submit button, it sends the info in the four fields to it's parent page. That all works great so far.

I want to make it so the user doesn't have to press the Submit button, but rather can just hit the [Enter] key. I know this is possible, I'm just not sure on how to script it.

Any help would be appreciated.

Scarecrow
 
use the onkeydown event for the form in document.onkeydown()

<script language=&quot;jscript&quot;>
document.onkeydown=function OnKeyDown() {

}

function OnKeyDown()
{


if (window.event.keycode==13)
yourfunction()
}

</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top