|
Posted by scripts.contact on 04/27/07 07:00
On Apr 26, 8:03 am, "Mr.G (@¿@)" <goo...@netzero.net> wrote:
> Hi and thanks in advance. I have a form and if the enter-key is
> pressed the from terminates and they never get to finish it. Is there
> a way to turn off the enter key? thanks.
you need some js:
function check(ev,form){
ev=window.event||ev;
var e=ev.target||ev.srcElement
if(ev.keyCode==13){
if(/submit|reset/i.test(e.type)||
e.tagName.toLowerCase()=="button")return
for(var i=0,es=form.elements;es[i]!=e&&i<es.length;i++){}
es[i+1].focus()
return false
}
}
In html:
<form ... onkeypress="return check(event,this)">
....
</form>
Test(ie users, stay away):
http://tinyurl.com/27r76r
Navigation:
[Reply to this message]
|