out of memory at line 6 ?图片轮转尝试!

huzhyo 2009-12-23 10:45:15
我简单的写了一个希望能实现图片轮转的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> </P>
</BODY></HTML>
...全文
852 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
huzhyo 2011-07-29
  • 打赏
  • 举报
回复
360不支持吗,没注意哦?
yksyuan 2011-06-21
  • 打赏
  • 举报
回复
为什么 楼主写的这个代码

IE 和google都支持。

360浏览器 就不支持呢????
xmliy 2009-12-23
  • 打赏
  • 举报
回复
iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])


Parameters

vCode 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.

huzhyo 2009-12-23
  • 打赏
  • 举报
回复
真的是这样,能解释一下为什么吗?这里的函数调用怎么不用括号呢或者'picshow()'也可以?
xmliy 2009-12-23
  • 打赏
  • 举报
回复
将setTimeout(picshow(),6000)改为setTimeout('picshow()',6000)或setTimeout(picshow,6000),经测试没什么问题
redlotus_lyn 2009-12-23
  • 打赏
  • 举报
回复
setTimeout(picshow,6000)即可。
cloudgamer 2009-12-23
  • 打赏
  • 举报
回复
setTimeout(picshow,6000)
这样?

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧