zoukankan      html  css  js  c++  java
  • XmlHttp 异步传输

    .aspx

    <Html>
    <head>
       <title></title>
       <script type="text/javascript">
          var Div,xmlhttp;
          function getXmlHttp()
           {
               Div= document.getElementById("div1");
               Div.innerHTML = "正在装载栏目数据,请稍侯.......  ";
               Div.style.display = ""; 
               var strParm="*";
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
               xmlhttp.onreadystatechange = getAjaxValue;  
               xmlhttp.open("POST","Execute.aspx?type=1",true);   
               xmlhttp.send(strParm); 
           }
          function getAjaxValue()
          {
             if(xmlhttp.readystate ==4)
             {
                if(xmlhttp.status == 200)
                   Div.innerHTML= xmlhttp.responseText;
                else
                   Div.innerHTML = "加载失败,原因:"+xmlhttp.statusText
             }
          }
       </script>
    </head>
    <body>
       <form id="form1" runat="server" >
            <input type="button" id="btnXmlJ" onClick="getXmlHttp();"/>
            <div id="div1"></div>
       </form>
    </body>

    Execute.aspx.cs

           Stream str = Request.InputStream;
            byte[] bt = new byte[str.Length];
            str.Read(bt, 0, Convert.ToInt32( str.Length));
            string parm= Encoding.UTF8.GetString(bt);
            int type = Convert.ToInt32( Request.QueryString["type"]);
             switch(type)
             {
                //实现功能.
             }
            Response.Write(返回值);
  • 相关阅读:
    兼容css3.0中的boxshadow
    获取页面和元素可视高度
    关于javascript中apply()和call()方法的区别
    BFC(Block Formatting Context)
    minheight最小高度的实现(兼容IE6、IE7、FF)
    sicily 1825. Nickname
    sicily 2000. Toy Shopping
    sicily 2075. 2.2 Computing the volume of a cylinder
    sicily 2001. Scavenger Hunt
    sicily 1608. Digit Counting
  • 原文地址:https://www.cnblogs.com/snlfq2000/p/1353327.html
Copyright © 2011-2022 走看看