如何能够实现页面的定时刷新,并且开销要小,页面要不动!!!

解决方案 »

  1.   

    页面不动?
    用setInterval和xmlhttp或者隐藏的帧吧,网上很多了。搜索
    xmlhttp 无刷新
      

  2.   

    var timer;
    function StartAutoRefresh()
    {
    // timer=window.setTimeout("alert('hello world');", 5000);
    timer=window.setTimeout("document.WebForm1.submit();", 5000);
    }

    function StopAutoRefresh()
    {
    window.clearTimeout(timerId);
    }
      

  3.   

    用XMLHTTP
    正好前几天用过,为了防止会话超时的。        <script language=javascript>
       //防止会话超时,利用XMLHTTP定时向该页发送请求
       function GetMessage()
       {
        var xh = new ActiveXObject("MSXML2.XMLHTTP");
        xh.open("POST",window.location.href+"?state=1",false)
        xh.send("");
        //600秒刷新,即10分钟刷新,这个是以毫秒为单位的100相当1秒
        window.setTimeout("GetMessage()",600000);   
       }
       window.onload=GetMessage;
       </script>