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

Auto Submit from a Enter Key Press

Status
Not open for further replies.

FRANDAZZO

Programmer
Nov 29, 2000
60
US
hi i had a really good idea for this but it is for a different language. i need this to work in javascript. anyway this was my idea and problem. when a user hits the enter button no matter what field he/she is in, the form has to submit. now i am already doing client side javascipt. so if the user fills out the last name input box and hits the "Enter" button on the Keyboard then the form must submit(actually call my jscript function). now in vb script i woulld just use to KeyAscii function and check to see is "13" the "Enter" key was pressed and then do something. is there any function like that in client side javascript.
 
create a function, this will work in IE:

function keyHandler(obj)
{
if(window.event.keyCode==13)
{
obj.form.submit()
}
}

and put this in your formfields:

onkeyup="keyHandler(this)"

jared@aauser.com
 
enter already submits in ie unless its a textarea.

adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top