js:
//铵enter键,阻止提交订单 function doClick(event) { // if ($.trim($('#' + buttonId + '').val()) == '') { // shorError(); // return; // } var key; if (window.event) key = window.event.keyCode; //IE else key = event.which; //firefox if (key == 13) { // if ($.trim($('#btnVerificationCode').val()) == '') { // shorError(); // } try { if (window.event) {//ie window.event.keyCode = 0 window.event.returnValue = false; } else {//firefox return false; } } catch (ex) { } } }
html:
<input id="btnVerificationCode" type="text" value="" style="width: 45px;" name="checkcode" onkeypress="return doClick(event);" maxlength="4" />