etc与mtc兼容收费:怎样实现html文本框在案回车键时失去焦点?

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/11 04:07:50
怎样实现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()">