注册 登录
编程论坛 jQuery论坛

在用到无刷技术的时候出现了堆栈问题怎么解决

enping 发布于 2012-10-20 23:47, 1564 次点击
只有本站会员才能查看附件,请 登录

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www. >
<head>
    <title></title>
   <script type="text/javascript">
       function onclick() {
           var xmlhttp;
           if (window.XMLHttpRequest) {
               xmlhttp = new XMLHttpRequest();
           }
           else {
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
           }
           if (!xmlhttp) {
               alert("aaa");
               return;
           }
           xmlhttp.open("POST", "Handler1.ashx?ts" + new Date(), false);

           xmlhttp.onreadystatechange = function() {
               if (xmlhttp.readyState == 4) {
                   if (xmlhttp.status == 200) {
                       document.getElementById("text1").value = xmlhttp.responseText;
                   }

                   else {
                       alert("ajax出错");
                   }
               }
           }
           xmlhttp.send();
       }

    </script>
 
</head>
<body>

    <input type=text  id="text1" />
 <input id=bt1 type=button onclick="onclick()" value="buttom" />
</body>
</html>
2 回复
#2
青春无限2012-10-31 10:19
看看
#3
欧阳mh2015-07-08 15:03
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
 <html xmlns="http://www. >
 <head>
      <title></title>
      <script type="text/javascript">
    if(typeof XMLHttpRequest == "undefined" && window.ActiveXObject==true){
        function XMLHttpRequest(){
              var a = new Array("Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP");
              for(var i=0; i<a.length; i++){
                  try
              {
              var oXMLHTTP = new ActiveXObject(a[i]);
              return oXMLHTTP;
             }catch(oError) {}
             }
             throw new Error("XMLHTTP");
        }
    }

    function onclick(){
        var xmlhttp;
        if(window.XMLHttpRequest){
            xmlhttp = new XMLHttpRequest();
        }else{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        if(!xmlhttp){
            alert("aaa");
            return;
        }

        xmlhttp.onreadystatechange = function(){
        if(xmlhttp.readyState == 4)&&(xmlhttp.status == 200){
            document.getElementById("text1").value = xmlhttp.responseText;
        }else{
            alert("ajax出错");
        }
        };
        xmlhttp.open("POST","Handler1.ashx?ts" + new Date(), false);
        xmlhttp.setRequestHeader("Content-Type", "gb2312");
        xmlhttp.send();
    }

     </script>

 </head>
 <body>

     <input type=text  id="text1" />
 <input id=bt1 type=button onclick="onclick()" value="buttom" />
 </body>
 </html>
1