当前位置:首页 >JavaScript > 正文内容

AJAX技术源码

大滑稽11年前 (2014-03-24)JavaScript1437

    <script language="javascript" type="text/javascript">
        function ajaxFunction() {
            var xmlHttp;

            try {
                // Firefox, Opera 8.0+, Safari
                xmlHttp = new XMLHttpRequest();
            }
            catch (e) {

                // Internet Explorer
                try {
                    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e) {

                    try {
                        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (e) {
                        alert("您的浏览器不支持AJAX!");
                        return false;
                    }
                }
            }

            xmlHttp.onreadystatechange = function () {
                if (xmlHttp.readyState == 4) {
                    //document.myForm.time.value = xmlHttp.responseText;

 document.getElementById("name").value = xmlHttp.responseText;
                }
            }
            xmlHttp.open("GET", "time.aspx", true);
            xmlHttp.send(null);
        }
    </script>

扫描二维码推送至手机访问。

版权声明:本文由第★一★次发布,如需转载请注明出处。

本文链接:http://www.wpers.net/post/65.html

返回列表

没有更早的文章了...

下一篇:AJAX ResponseXML 实例

“AJAX技术源码” 的相关文章

JS生成范围内随机数

        function random(min, max) {        &n...

console.log 被重写覆盖以后如何恢复

有时候一些项目中会使用类似如下的方式覆盖掉console对象:var console = {}; console.log = function(){}; console.info&nbs...