日期:2014-05-16 浏览次数:20432 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登陆</title>
</head>
<body>
<form name="input" action="#" method="post" onsubmit="return mylogin()">
<p>用户名:
<input type="text" name="user" value=""/><br />
密码:
<input type="password" name="password" /><br />
<input type="submit" value="登录"/><br />
</p>
</form>
<div id="msg"></div>
<script>
function mylogin()
{
var xmlhttp;
var f = document.forms["input"];
var usr=f.user.value;
var pwd=f.password.value;
var strPost = "user="+usr+"&password="+pwd;
var words;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","/longinOver.php",true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(strPost);
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
words=xmlhttp.responseText;
}
if("55"!="1 ")
{
return false;
}else{
return false;
}
document.getElementById("msg").innerHTML=words+"5 55";
}
// return false;
}
</script>
<p>
</p>
</body>
</html>