Reply to Re: How does one stop the enter-key from working?

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация