首页 > 其他 > 详细

简单的图片轮翻效果2

时间:2015-11-14 21:57:59      阅读:174      评论:0      收藏:0      [点我收藏+]
所需html代码如下: 

1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>用js来实现图片轮翻</title> 6 </head> 7 8 <body> 9 <img id="img1" src="images/1.jpg" /> 10 </body> 11 </html>
接下来是真正起作用的js代码
 1 <script type="text/javascript">
 2     var i=1;
 3     function  init()
 4     {
 5        
 6         i++;
 7         //获取id=img1的对象
 8        var  obj=document.getElementById("img1");
 9        obj.src="images/"+i+".jpg";
10        window.setTimeout("init()",1000);
11        if(i>=6)
12          {
13              i=0;
14          }     
15     }
16 </script>    

 

 

 

简单的图片轮翻效果2

原文:http://www.cnblogs.com/qijunjun/p/4965094.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!