﻿// JScript 文件
    //该源码下载自www.51aspx.com(５１ａｓｐｘ．ｃｏｍ)

    //1.我们首先创建一个全局变量
    //2.我们在创建一个XmlHttpRequest对象
    var xmlHttp;
    
    function createXmlHttpRequest()
    {
        if(window.XMLHttpRequest)
        {
            xmlHttp=new XMLHttpRequest();
        
            if(xmlHttp.overrideMimeType)
                {
                    xmlHttp.overrideMimeType("text/xml");
                }
        }
        else if(window.ActiveXObject)
        {
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   
            }
            catch(e)
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");   
            }
        }
        if(!xmlHttp)
        {
            window.alert("你的浏览器不支持创建XMLhttpRequest对象");
        }
        return xmlHttp;
    }
    

    function ReBtn()
    {
        //document.getElementById("Img").src="image/load.gif";
        window.location.reload();
    }
    
    function ValidateCode()
    {
        createXmlHttpRequest();
        
        var url="ValidateCode.aspx?Code="+document.getElementById("TxtAccept").value;
        
       // window.alert(document.getElementById("TxtAccept").value);
        
        //var url="DisposeEvent.aspx?Name="+document.getElementById("UserName").value
        
        xmlHttp.open("GET",url,true);
        
        xmlHttp.onreadystatechange=ValidateResult;
        
        xmlHttp.send(null);
    }
    
    function ValidateResult()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
                if(xmlHttp.responseText=="YES")
                {
                    window.alert("正确");
                }
                else
                {
                    window.alert("错误的验证码");
                    
                    window.location.reload();
                }
            }
        }
    }