var xmlHttp;
function $_xmlhttprequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
    } else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

function getcdk(id) {
    $_xmlhttprequest();
    var post="game_id="+id;//构造要携带的数据 
    xmlHttp.open("POST","/getcdk.php",true);//使用POST方法打开一个到服务器的连接，以异步方式通信 
    xmlHttp.setrequestheader("content-length",post.length); 
    xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");  
    xmlHttp.onreadystatechange = byphp;
    xmlHttp.send(post);//发送数据
}

function byphp() {
    if(xmlHttp.readyState==1) {
        document.getElementById('text').innerHTML = "<img src=../images/loading_1.gif> 正在处理请求，请稍等......";
    }
    if(xmlHttp.readyState==4) {
        if(xmlHttp.Status==200) {
            var byphptext = xmlHttp.responseText;
            document.getElementById('text').innerHTML = byphptext;
        }
    }

}
