日期:2014-05-19 浏览次数:20901 次
$(function(){ $("#username").focus(); $("#loginBtn").click(function(){ var username = $("#username").val(); var password = $("#password").val(); if($.trim(username)==""){ $("#messagebox").html("用户名不能为空!"); return; } if($.trim(password)==""){ $("#messagebox").html("密码不能为空!"); return; } $.post("login!verifyUser",{username:username,password:password},function(data)//这一行是什么意思? { if(data == '1') { $("#messagebox").html("密码错误!"); }else if(data == '2'){ $("#messagebox").html("用户不存在!"); }else{ $("#loginFrm").get(0).submit(); } }); });
<%@ page pageEncoding="UTF-8"%> <%@ taglib uri="/struts-tags" prefix="s" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>测试系统</title> <link href="css/login2.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="plugins/easyui/themes/default/easyui.css"> <script src="js/jquery.min.js"></script> <script type="text/javascript" src="plugins/easyui/jquery.easyui.min.js"></script> <script src="js/login.js"></script> </head> <body id="login"> <s:form id="loginFrm" action="login!loginToIndex" method="post" > <div class="login_bg"></div> <div class="login_content"> <ul> <li class="logoe">图书管理 <li class="logoo" id="name"><div id="loginname">用户名:<input id="username" name="username"/></div></li> <li class="logo1" id="pwd"><div id="passworddiv">密 码 :<input type="password" name="password" id="password" /></div></li> <li class="logo2" id="ver1"><a id="loginBtn" style="cursor: pointer;"><img src="images/login_bottom.png" /></a></li> <li class="logo3" id="l_msg1"><span id="messagebox"></span></li> </ul> </div> </s:form> </body>