1.实现文本框焦点自动跳转及通过回车键提交表单
<
asp:textbox
id
="passwd"
onkeydown
="if(event.keyCode==13){document.all.imgbtnlogin.focus();event.keyCode=13;event.keyCode=13;return true;}"
runat
="server"
BorderStyle
="Ridge"
TextMode
="Password"
></
asp:textbox
>
![](https://i-blog.csdnimg.cn/blog_migrate/f0cd6c7f9e7ae96feae062cb48f670f0.gif)
document.all.imgbtnlogin.focus();中的imgbtnlogin为提交按钮的ID
当你提交的button之前还有button的时候要把.UseSubmitBehavior="False"写上.否则所有的button都会提交.
还有就是firefox 下,event必须作为参数传到单独写的function中, ..οnkeydοwn="GetLogFocus(event);"
不能在方法中直接用 if(event.keyCode == 13)