酒泉运政信息网:怎样实现html文本框在案回车键时失去焦点?

来源:百度文库 编辑:高校问答 时间:2024/05/12 10:28:58
怎样实现html文本框在案回车键时失去焦点?

我有多个文本框,需要响应回车。

你要的是不是在一个文本框输入回车后,跳转到另外一个文本框?
html代码如下

<input type=text name=t1 onkeydown="if(event.keyCode==13) document.all.t2.focus();">
<input type=text name=t2 onkeydown="if(event.keyCode==13) document.all.t3.focus();">
<input type=text name=t3 onkeydown="if(event.keyCode==13) document.all.t4.focus();">
<input type=text name=t4 onkeydown="if(event.keyCode==13) document.all.t1.focus();">

<input type="text" onKeyPress="if(window.event.keyCode==13) this.blur()">