C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

         function Ajax(){
   
             //    doc.innerHTML='<span><img src="image/load.gif"/>Loading...</span>';
            ////创造对象
            var xmlhttp;
            if (window.ActiveXObject){
                /* 不要删除以下注释,这部分不是注释 */
                /*@cc_on @*/
                /*@if (@_jscript_version >= 5)
                try {
                  xmlhttp = new ActiveXObject("Msxml2.xmlhttp");
                } catch (e) {
                  try {
                    xmlhttp = new ActiveXObject("Microsoft.xmlhttp");
                  } catch (e) {
                    xmlhttp = false;
                  }
                }
                @end @*/
            }else{
                xmlhttp=new XMLHttpRequest();
            }
            if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
              xmlhttp = new XMLHttpRequest();
            }
           
            if(!xmlhttp)
            {
            alert("你的浏览器不支持xmlhttp对象,所以一些功能无法使用,建议使用高版本的浏览器!!");
            return;
            }

    
            ///函数主题
                this.getData=function(url,data,dodata)
                {
                    var verbs =data;
                    xmlhttp.open("POST", url,true);

                        xmlhttp.onreadystatechange=function(){
                            if (xmlhttp.readyState==4){
                                dodata(xmlhttp);                 
                            }
                        }
                    xmlhttp.setRequestHeader("Content-Length",verbs.length);
                    xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
                    xmlhttp.send(verbs);
                }
            ///函数主题
}

posted on 2008-06-10 15:58  王德田  阅读(231)  评论(0编辑  收藏  举报