How to disable "Enter Key" to submit?

<form action=»foo»>
<input type=»text» onkeypress=»return bar(event)»>
<input type=»submit»>

<script type=»text/javascript»>
function bar(evt){
var k=evt.keyCode||evt.which;
return k!=13;

Note however that this «enter» key behavior isn’t standard (and actually behaves differently across user agents); moreover this won’t prevent you from full server-side checking, as a client can have javascript deactivated (or even trick your javascript at runtime).

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *