JS脚本对象兼容的一般写法

var http = null;
            try
            {
                http=new ActiveXObject("Msxml2.XMLHTTP")
            }
            catch(e)
            {
                try
                {
                    http = new ActiveXObject("Microsoft.XMLHTTP")
                }
                catch (oc)
                {
                    http = null
                }
            }
            if (!http && typeof XMLHttpRequest != "undefined") {
                http = new XMLHttpRequest();
             }
           
            http.open("get", "getjournalHandler.ashx?id=" + id + "&rd=" + new Date(), false);
            http.send(null);

posted @ 2011-07-29 16:25  _IsSam  阅读(236)  评论(0编辑  收藏  举报