input
<script> function EnterPress(e){ //传入 event var e = e || window.event; if(e.keyCode == 13){ document.getElementByIdx_x_x("txtAdd").focus(); } } </script> <input type="text" id="txtName" onkeypress="EnterPress(event)" onkeydown="EnterPress()" /> <input type="text" id="txtAdd" />
jquery提交
$(function () { document.onkeydown = function (event) { var e = event || window.event || arguments.callee.caller.arguments[0]; if (e && e.keyCode == 13) { //to do something; } }; });
时间: 2024-10-07 18:47:46