jsp:页面
<label>验证码</label>
<input type="text" class="text" style="width:150px;" id="txt_val" placeholder="验证码" name="txt_val" tabindex="3" οnkeypress="keyPress(this)"/>js:
function onkeypress(obj){
var theEvent = window.event || arguments.callee.caller.arguments[0];
var code = theEvent.keyCode || theEvent.which; if(code == 13){ //回车键的code等于13 $form("Xxx").submit();//提交表单 }}