怎么后面执行的越来越快!!!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- saved from url=(0014)about:internet -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
var i=0;
function reloop(){
i=i+1;
alert(String(i));
    setInterval("reloop()",3000);
}
</script>
</head>
<body onload="reloop()">
</body>
</html>

解决方案 »

  1.   

    setInterval 功能类似于递归函数
      

  2.   

    没有clear的话setInterval这个方法将一直以设置的时间调用函数如果想隔段时间调用自身可以用 setTimeout setTimeout("reloop()",3000); 
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <!-- saved from url=(0014)about:internet --> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>无标题文档 </title> 
    <script language="javascript"> 
    var i=0; 
    function reloop(){ 
    i=i+1; 
    alert(String(i)); 
    }
    setInterval(reloop,3000);  
    </script> 
    </head> 
    <body onload="reloop()"> 
    </body> 
    </html>