<script> |
| function login(){ |
| var userId = $('#userId').val(); |
| var userPwd = $('#userPwd').val(); |
| if(userId && userPwd){ |
| $.ajax({ |
| type: "post", |
| url: "login!userLogin.action", |
| data: {"userId":userId,"userPwd":hex_md5(userPwd)}, |
| contentType:"application/x-www-form-urlencoded;charset=UTF-8", |
| dataType:"json", |
| success: function(data){ |
| if(data.success){ |
| location.href="index.jsp"; |
| }else{ |
| alert(data.errMsg); |
| } |
| } |
| }); |
| }else{ |
| alert("用户名或密码不能为空"); |
| } |
| } |
| $(function(){ |
| $(".login-form").css({ |
| opacity: 1, |
| "-webkit-transform": "scale(1)", |
| "transform": "scale(1)", |
| "-webkit-transition": ".5s", |
| "transition": ".5s" |
| }); |
| $('#userPwd').live("keyup",function(e){ |
| if (e.keyCode == 13) { |
| login(); |
| } |
| }); |
| $('#loginBtn').live('click',function(){ |
| login(); |
| }); |
| }); |
| </script> |
| </head> |
| <body class="bg-darkTeal"> |
| <div class="login-form padding20 block-shadow"> |
| <form> |
| <h1 class="text-light">登录学院后台</h1> |
| <hr class="thin"/> |
| <br /> |
| <div class="input-control text full-size" data-role="input"> |
| <label for="user_login">用户名</label> |
| <input type="text" name="userId" id="userId"> |
| </div> |
| <br /> |
| <br /> |
| <div class="input-control password full-size" data-role="input"> |
| <label for="user_password">密码</label> |
| <input type="password" name="userPwd" id="userPwd"> |
| </div> |
| <div class="form-actions"> |
| <div style="float:right;"> |
| <button id="loginBtn" type="button" class="button primary">登录</button> |
| </div> |
| </div> |
| <br/> |
| <br/> |
| </form> |
| </div> |
| </body> |
| </html> |