Ajax简单异步传输

// JavaScript Document
// 异步传输
// 2011-04-01
// by hkshadow 
// QQ 2765237

    var RegHtml
    function RegHtmls() {
        if (window.ActiveXObject) {
            RegHtml = new ActiveXObject('Microsoft.XMLHTTP');
            }else if (window.XMLHttpRequest) {
                RegHtml = new XMLHttpRequest();
                }
                }

    function BiddingFeed(did,puser,url) {
        RegHtmls();
        RegHtml.open("GET",url+puser,true);
        RegHtml.onreadystatechange = function() {Divt(did)};
        RegHtml.send(null);
        }

    function Divt(did) {            
            if (RegHtml.readyState == 1)  {
        document.getElementById(did).innerHTML="loading....";
        }else if (RegHtml.readyState == 4 && RegHtml.status == 200 ) {
        document.getElementById(did).innerHTML=RegHtml.responseText;
            }else{
        document.getElementById(did).innerHTML='失去通信.....请刷新';
            }
        }

Leave a Reply

(will not be published)