﻿
var xmlHttp;


function createXMLHttpRequest() {
        if(window.XMLHttpRequest) {
              xmlHttp = new XMLHttpRequest();//mozilla浏览器
        }
        else if(window.ActiveXObject) {
            try {
             xmlHttp = new ActiveX0bject("Msxml2.XMLHTTP");//IE老版本
            }
            catch(e)
            {}
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IE新版本
            } 
            catch(e)
            {}
            if(!xmlHttp) {
                window.alert("不能创建XMLHttpRequest对象实例");
                return false;
            }
        }
    }


function startRequestuser(username) {   
            

            createXMLHttpRequest();//特编 
            xmlHttp.open("GET","ckuser.php?name="+username,true);
            xmlHttp.onreadystatechange = handleStateChangenickname;
            xmlHttp.send(null);
        }


function handleStateChangenickname() {

        if(xmlHttp.readyState==4) {
            if(xmlHttp.status==200) {
                 
                if(xmlHttp.responseText=="true") {

                     alert ("该昵称以被注册，不可以用");

                }
               else if(xmlHttp.responseText=="false") {                     

                     alert('恭喜您,该昵称可以使用');

                }
			   else if(xmlHttp.responseText=="feifa") {                     

                     alert('请检查您的用户名，按规则填写用户名！');

                }
				else if(xmlHttp.responseText=="weikong"){
					alert('用户名为空，请输入');
				}
				
            }
        }
    }