﻿function GetUserName()
{

    var txtUser = document.getElementById("username").value;
    var inputpwd=document.getElementById("inputpwd").value;
     var url = "Ajax/userlogin.aspx?usrName=" + txtUser+"&spwd="+inputpwd;
    var oXmlHttp=new createXMLHttp();
    oXmlHttp.open("get",url,true);
    oXmlHttp.onreadystatechange = function(){
        if(oXmlHttp.readyState == 4)
        {
            if(oXmlHttp.status == 200||oXmlHttp.status == 304) {  
            var daxie=oXmlHttp.responseText.toLocaleUpperCase().replace(/[ ]/g,"") ;
             if(daxie=="TRUE"){
               alert('登录成功');
               window.location="index.aspx";
             }
             else{
                alert('登录失败');
             }
            }else
            {
               GetName("An error occurred:" + oXmlHttp.statusText);
            }
        }
    }
    oXmlHttp.send(null);
  }
