disabling functionality of the enter key for a file upload [duplicate]
Possible Duplicate:
Disabling enter key for form
How do I disable the enter key on a file upload input box. I submit this form progmatically in javascript. I don't want the user to submit it by pressing the enter key (this is what happens when the user presses the enter key).
The programatic submit is with in an ajax call like this.
document.f1_1.submit();
It calls t开发者_如何学编程he .php file listed in the attribute of the form f1_1.
Thanks
From google and assuming no javascript library like Jquery:
http://www.bloggingdeveloper.com/post/Disable-Form-Submit-on-Enter-Key-Press.aspx
This is easier than the other SO and google posts I've seen. Works on IE 9 at a minimum.
Just bind this method to the input box:
function bind_fu(event)
{
if(event.keyCode==13)
{
return false;
}
}
精彩评论