|
不好意思,我把你的代码修改了一下,你可以试试。我用asp测试过没问题:
<SCRIPT LANGUAGE="JavaScript">
<!--
function login(){
if(document.getElementById("uid").value==""||document.getElementById("pwd").value==""){
document.getElementById("info").innerHTML="用户名或密码为空!";
}
else{
startRequest();
}
}
var xmlHttp;
function createXMLHttpRequest(){
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlHttp = new ActiveXObject("Mircosoft.XMLHTTP");
}
catch(e){
try{
xmlHttp = new XMLHttpRequest();
}
catch(e){
alert("对不起,浏览器不支持");
}
}
}
}
function startRequest(){
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("post", "admin_validate.php", true);
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttp.send("uid="+document.getElementById("uid").value+"&pwd="+document.getElementById("pwd").value);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200 || xmlHttp.status == 0) {
document.getElementById("info").innerHTML = xmlHttp.responseText;
}
}
}
//-->
</SCRIPT>
|