﻿
    function createXmlHttpRequest()
    {
        var xmlHttp;
        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 GetAdvOnClick(mainUrl,typeid,id)
    {
        var url = "http://" + window.location.host + "/server.aspx?type="+typeid + "&id=" + id + "&temp="+(new Date().getTime().toString(36));
        xmlHttp = createXmlHttpRequest();        
        xmlHttp.open("GET",url,true);
        xmlHttp.onreadystatechange=ValidateResult;
        xmlHttp.send(null);
    }
    
    function ValidateResult()
    {
        if(xmlHttp.readyState==4)
        {
            if(xmlHttp.status==200)
            {
               //window.alert(xmlHttp.responseText);
               window.location.reload();
            }
        }
    }