<input tpye=checkbox id=aa onclick="gua()">
<script>
function gua()
{var timer=null;
if(aa.checked)
 timer=settimeout("window.location.reload()",5000);//每隔5秒
else
  if(timer!=null)
 clearTimeout(timer);
}
</script>

解决方案 »

  1.   

    zhangguagua(瓜瓜) 老大,怎么说缺少对象呀timer
      

  2.   

    zhangguagua(瓜瓜)刷新一下付选框就不选中了,有不能刷新了,我要只要选中就一直刷新的呀
      

  3.   

    <input type=checkbox id=rfc onclick="ref()">
    <script>
    function ref()
    {
      if(rfc.checked==true)
         {timecount=setTimeout("window.location.reload()",5000);}
      else
         {clearTimeout(timecount);}
    }
    </script>zhangguagua(瓜瓜) 的代码中,setTimeout()大小写搞错了。
      

  4.   

    <input id=chkRefresh type=checkbox value="Refresh" onclick="setrefresh()">
    <script>
    if(document.location.search)
    {
     document.getElementById("chkRefresh").checked=true;
     refreshinterval=setInterval("location.href='2.htm?refresh=true'",2000);
    }
    function setrefresh()
    {
    if(document.getElementById("chkRefresh").checked==true)
      {refreshinterval=setInterval("location.href='2.htm?refresh=true'",2000);}
    else
      {clearInterval(refreshinterval);}
    }
    </script>
      

  5.   

    2.htm改成你頁面的名稱就可以了
      

  6.   

    多谢 tdl982324(石井坚) 给分
      

  7.   

    多谢  tdl982324(石井坚)  给分
      

  8.   

    document.location.search什么意思?
      

  9.   

    搜索文件名後傳入的參數,這裡傳入了refresh=true我只是判斷了是否有,如果有,就將checkbox勾選,然後刷新
      

  10.   

    alert(document.location.search);如果有多個就要拆分了...