当前位置:Gxlcms > JavaScript > js文本框输入点回车触发确定兼容IE、FF等

js文本框输入点回车触发确定兼容IE、FF等

时间:2021-07-01 10:21:17 帮助过:2人阅读

代码如下:

<head>
<script>
function EnterPress(e){ //传入 event
var e = e || window.event;
if(e.keyCode == 13){
document.getElementById("txtB").focus();
}
}
</script>
</head>
<body>
<input type="text" id="txtA" onkeypress="EnterPress(event)" onkeydown="EnterPress()" />
<input type="text" id="txtB" />
</body>

人气教程排行