文本框焦点自动跳转及通过回车键提交表单的几种代码
<
script language
=
"
javascript
"
for
=
"
document
"
event
=
"
onkeydown
"
>
<!--
// 回车换行
if (event.keyCode == 13 && event.srcElement.id == " tbKey " )
{event.keyCode == 13 ; return ;}
if (event.keyCode == 13 && event.srcElement.type != 'button' && event.srcElement.type != 'submit' && event.srcElement.type != 'reset' && event.srcElement.type != 'textarea' && event.srcElement.type != '')
event.keyCode = 9 ;
-->
</ script >
<!--
// 回车换行
if (event.keyCode == 13 && event.srcElement.id == " tbKey " )
{event.keyCode == 13 ; return ;}
if (event.keyCode == 13 && event.srcElement.type != 'button' && event.srcElement.type != 'submit' && event.srcElement.type != 'reset' && event.srcElement.type != 'textarea' && event.srcElement.type != '')
event.keyCode = 9 ;
-->
</ script >
<
script language
=
"
javascript
"
for
=
"
document
"
event
=
"
onkeydown
"
>
<!--
// 回车换行
if (event.keyCode == 13 && event.srcElement.type != 'button' && event.srcElement.type != 'submit' && event.srcElement.type != 'reset' && event.srcElement.type != 'textarea' && event.srcElement.type != '')
document.getElementById( " tbnDone " ).click();
-->
</ script >
<!--
// 回车换行
if (event.keyCode == 13 && event.srcElement.type != 'button' && event.srcElement.type != 'submit' && event.srcElement.type != 'reset' && event.srcElement.type != 'textarea' && event.srcElement.type != '')
document.getElementById( " tbnDone " ).click();
-->
</ script >