java回车键登录

<script language="javascript"> 
//回车键登录
function enterlogin(){
    if(event.keyCode == 13){
        event.returnValue=false;
        event.cancel = true;
        $("#loginForm").submit();
    }
}
</script> 

</head>

<body onkeydown="enterlogin()">
    <form id="loginForm" action="<%=basePath%>getLogin" method="post">
    <ul>
    <li>
        <input name="username" type="text" class="loginuser" value="admin" />
    </li>
    <li>
        <input name="password" type="text" class="loginpwd" value="123"/>
    </li>
    <li>
        <input name="" type="submit" class="loginbtn" value="登录"  />
        <label><input name="" type="checkbox" value="" checked="checked" />记住密码</label>
        <label><a href="#">忘记密码?</a></label></li>
    </ul>
    </form>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_35123802/article/details/78200749