JS input 回车提交
12/12/2010 7:41:02 PM
<asp:Button ID="btnLogin" runat="server" Text="Login" onclick="btnLogin_Click" />
<script type="text/javascript">
//执行键盘按键命令
function SubmitKeyClick(e) {
var keycode = "0";
//IE浏览器
if (browser == "Microsoft Internet Explorer") {
keycode = event.keyCode;
}
else {
//火狐浏览器
keycode = e.which;
}
if (keycode == "13") //回车键是13
{
document.getElementById("ctl00_ContentPlaceHolder1_btnLogin").focus();
document.getElementById("ctl00_ContentPlaceHolder1_btnLogin").click();
return;
}
}
</script>