Connecting Tech Pros Worldwide Forums | Help | Site Map

form text boxes

abracad_1999@yahoo.com
Guest
 
Posts: n/a
#1: Mar 11 '06
is there a way to allow user to hit enter in a form text box and run a
javascript function rather than submitting the form?


Jonas Raoni
Guest
 
Posts: n/a
#2: Mar 11 '06

re: form text boxes


abracad_1999@yahoo.com wrote:[color=blue]
> is there a way to allow user to hit enter in a form text box and run a
> javascript function rather than submitting the form?[/color]

Try

form.onkeypress = function(e){
if(((e ? e : e = event).which || e.keyCode) == 13){
MyFunction();
return false;
}
};


--
Now with alcohol <URL:http://youtube.com/watch?v=lnQTZxqxc10> =X
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Closed Thread