⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iexmlhttprequestexample2.htm

📁 这是javascript高级程序设计的源码
💻 HTM
字号:
<html>
    <head>
        <title>XML HTTP Request Example</title>
        <script type="text/javascript">
        
                function createXMLHTTP() {
                
                    var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
                                         "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
                                         "Microsoft.XMLHTTP"];
                                         
                    for (var i=0; i < arrSignatures.length; i++) {
                        try {
                        
                            var oRequest = new ActiveXObject(arrSignatures[i]);
                            
                            return oRequest;
                        
                        } catch (oError) {
                            //ignore
                        }
                    }          
                
                    throw new Error("MSXML is not installed on your system.");               
                }
                
                function getServerInfo() {
                        var oRequest = createXMLHTTP();
                        oRequest.open("get", "example.xml", false);
                        oRequest.send(null);
                        alert("Status is " + oRequest.status + " (" + oRequest.statusText + ")");
                        alert("Response text is: " + oRequest.responseText);
                        alert("Tag name of document element is: " + oRequest.responseXML.childNodes.length);
                }

        </script>
    </head>
    <body>
        <p>Click the button to make a call to the server using an XML HTTP request.
        This example may not function properly when running outside of a Web server.</p>
        <input type="button" onclick="getServerInfo()" value="Get Server info" />
    </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -