我简单的写了一个希望能实现图片轮转的js,但是每次运行的时候都出来out of memory at line 的错误提示,感觉逻辑应该没有问题,请帮看看是哪里没有搞通?谢谢!<HTML>
<HEAD>
<script type="text/javascript">
   function picshow()
   {
  var r1 = document.getElementById("img1");
  var r2 = document.getElementById("img2");
  var r3 = document.getElementById("img3");
  var r4 = document.getElementById("img4");   
  var r5 = document.getElementById("imgshow");
  
    rtemp = r5.src;
r5.src = r4.src;
r4.src = r3.src;
r3.src = r2.src;
r2.src = r1.src;
r1.src = rtemp;
   
   setTimeout(picshow(),6000)
   }
</script></HEAD>
<BODY onLoad="picshow();">
<P>WelCome to My site!<BR>Hope can bring more funny for you!<BR>Enjoying yourself!</P>
<table width="303" border="0" align="center">
  <tr>
    <td colspan="4"><img id="imgshow" src="img/05.jpg" width="400" height="300" alt=""></td>
  </tr>
  <tr>
    <td width="100"><img id="img1" src="img/01.jpg" width="100" height="75" alt="" style="background-color: #0099FF"></td>
    <td width="100"><img id="img2" src="img/02.jpg" width="100" height="75" alt="" style="background-color: #FF0000"></td>
    <td width="100"><img id="img3" src="img/03.jpg" width="100" height="75" alt="" style="background-color: #FFFF00"></td>
    <td width="100"><img id="img4" src="img/04.jpg" width="100" height="75" alt="" style="background-color: #FF00FF"></td>
  </tr>
</table>
<P>&nbsp;</P>
</BODY></HTML>

解决方案 »

  1.   

    setTimeout(picshow,6000) 
    这样?
      

  2.   

    将setTimeout(picshow(),6000)改为setTimeout('picshow()',6000)或setTimeout(picshow,6000),经测试没什么问题
      

  3.   

    真的是这样,能解释一下为什么吗?这里的函数调用怎么不用括号呢或者'picshow()'也可以?
      

  4.   

    iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])
    ParametersvCode Required. Variant that specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed. 
    iMilliSeconds Required. Integer that specifies the number of milliseconds. 
    sLanguage Optional. String that specifies one of the following values: JScript Language is JScript. 
    VBScript Language is VBScript. 
    JavaScript Language is JavaScript. 
     
      

  5.   

    为什么 楼主写的这个代码 IE 和google都支持。360浏览器 就不支持呢????