| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 375 人关注过本帖
标题:求个合理解释
只看楼主 加入收藏
SocketHack
Rank: 2
等 级:论坛游民
帖 子:14
专家分:30
注 册:2010-8-7
结帖率:50%
收藏
已结贴  问题点数:0 回复次数:2 
求个合理解释
<html>
<head>
<title> A Timed Slide show</title>
<script type="text/javascript">
<!--hide me from older browsers
var the_images=new Array();
the_images[0]=new Image();
the_images[0].src="one.jpg";
the_images[1]=new Image();
the_images[1].src="two.jpg";
the_images[2]=new Image();
the_images[2].src="three.jpg";
var the_timeout;
//var index=0;
function rotateImage(index)
{
    window.document.my_image.src=the_images[index].src;
    index++;
    if(index>=the_images.length)
        {
            index=0;
        }
the_timeout=setTimeout("rotateImage(index);",1000);
}
//show me-->
</script>
</head>
<body>
<img name="my_image" src="one.jpg">
<from>
<input type="button" value="Start the Show"
onClick ="clearTimeout(the_timeout);rotateImage(0);">
<input type="button" value="Stop the Show"
onClick="clearTimeout(the_timeout);">
</form>
</body>
</html>
2011-09-03 23:42
zsaihz
Rank: 2
等 级:论坛游民
帖 子:7
专家分:46
注 册:2011-9-2
收藏
得分:20 
图片切换,单击开始图片开始切换,单击停止图片停止切换!
2011-09-04 14:02
SocketHack
Rank: 2
等 级:论坛游民
帖 子:14
专家分:30
注 册:2010-8-7
收藏
得分:0 
回复 2楼 zsaihz
谢谢了,这个问题只是我对于settimeout函数带参数调用不是很理解,多谢你的回答..
2011-09-04 18:33
快速回复:求个合理解释
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019642 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved