﻿function createXMLHTTP() {
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest(); //mozilla浏览器
    }
    else if (window.ActiveXObject) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        { }
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        { }
        if (!xmlHttp) {
            window.alert("不能创建XMLHttpRequest对象实例！");
            return false;
        }
    }
    return false;
}

function LikeKeywords() {
    createXMLHTTP();
    var url = "Ajax.aspx?keywords=" + document.getElementById("TextBox1").value + "&temp="+Math.random();
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = GetLikeKeywords;
    xmlHttp.send(null);
}

function GetLikeKeywords() {
    if (xmlHttp.readyState == 4)//判断对象状态
    {
        if (xmlHttp.status == 200) {
            if(xmlHttp.responseText!="no")
            {
                document.getElementById("keydiv").style.display="block";
                document.getElementById("keydiv").innerHTML=xmlHttp.responseText;
            }
            else{
                document.getElementById("keydiv").style.display="none";
                document.getElementById("keydiv").innerHTML="";
            }
        }
    }
}


function IndexBrand(zimu) {
    createXMLHTTP();
    var url = "Ajax.aspx?zimu=" + zimu + "&temp=" + Math.random();
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = GetIndexBrand;
    xmlHttp.send(null);
}
function GetIndexBrand() {
    if (xmlHttp.readyState == 4)//判断对象状态
    {
        if (xmlHttp.status == 200) {
            document.getElementById("indexbrand").innerHTML = xmlHttp.responseText;
        }
    }
}
