-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
120 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
var xmlHttp=false; | ||
function createXMLHttpRequest() | ||
{ | ||
if (window.ActiveXObject) //在IE浏览器中创建XMLHttpRequest对象 | ||
{ | ||
try{ | ||
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); | ||
} | ||
catch(e){ | ||
try{ | ||
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); | ||
} | ||
catch(ee){ | ||
xmlHttp=false; | ||
} | ||
} | ||
} | ||
else if (window.XMLHttpRequest) //在非IE浏览器中创建XMLHttpRequest对象 | ||
{ | ||
try{ | ||
xmlHttp = new XMLHttpRequest(); | ||
} | ||
catch(e){ | ||
xmlHttp=false; | ||
} | ||
} | ||
} | ||
function logincheck(){ | ||
var usernameinput = document.getElementById("usernameinput").value; | ||
var passwordinput = document.getElementById("passwordinput").value; | ||
createXMLHttpRequest(); //调用创建XMLHttpRequest对象的方法 | ||
xmlHttp.onreadystatechange=logincheckResult; //设置回调函数 | ||
var url="LoginAction?action=login&username=" + usernameinput + "&password=" + passwordinput; | ||
xmlHttp.open("POST",url,true); //向服务器端发送请求 | ||
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf8"); | ||
xmlHttp.send(null); | ||
} | ||
|
||
function logincheckResult(){ | ||
var usernameinput = document.getElementById("usernameinput").value; | ||
var passwordinput = document.getElementById("passwordinput").value; | ||
if (xmlHttp.readyState==4 && xmlHttp.status==200){ | ||
var data= xmlHttp.responseText; | ||
document.getElementById("checkinfo").innerHTML = ""; | ||
if(data == "false"){ | ||
document.getElementById("checkinfo").innerHTML = "用户名或密码错误"; | ||
} | ||
if (usernameinput == ""){ | ||
document.getElementById("checkinfo").innerHTML = "用户名不能为空"; | ||
} | ||
if (passwordinput == ""){ | ||
document.getElementById("checkinfo").innerHTML = "密码不能为空"; | ||
} | ||
if (usernameinput == "" && passwordinput == ""){ | ||
document.getElementById("checkinfo").innerHTML = "用户名和密码不能为空"; | ||
} | ||
if(document.getElementById("checkinfo").innerHTML == ""){ | ||
window.location.href="main.jsp"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters