function CreateXmlRequest(){
var xmlHttp=null;
if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}else if(window.ActiveXObject){
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
xmlHttp=false;
}
}
}
return xmlHttp;
}
function CreateAdd(){
var username=document.getElementById("username").value;
var password=document.getElementById("password").value;
alert("password="+password)
var request=CreateXmlRequest();
if(!request){
document.getElementById("show").innerHTML="当前浏览器不支持javascript";
}else{
var content="username="+username+"&password="+password;
request.open("post","addObj",false);
request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
request.send(content);
request.onreadystatechange=function(){
if(request.readyState==4){
document.getElementById("show").innerHTML="loading...";
if(request.status==200){
var result=request.responseText;
alert(result)
if(result=="add"){
document.getElementById("show").innerHTML="增加成功";
}else if(result=="notadd"){
document.getElementById("show").innerHTML="增加失败";
}
}
}
}
document.getElementById("show").innerHTML="";
}
}