码迷,mamicode.com
首页 > 其他好文 > 详细

图片轮播

时间:2016-11-05 09:36:00      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:idt   title   int   one   css   char   doctype   charset   pos   

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#tab { overflow:hidden; width:400px; height:250px; position:relative; float:left;}
#tab>img:not(:first-child){ display:none; }

</style>
<script>
window.onload = function(){

var images = document.getElementsByTagName(‘img‘);
var pos = 0;
var len = images.length;

setInterval(function(){

images[pos].style.display = ‘none‘;
pos = ++pos == len ? 0 : pos;
images[pos].style.display = ‘inline‘;

},1000);

};
</script>

</head>

<body>
<div id="tab">
<img src="nssl0033.jpg" width="400" height="250"/>
<img src="nssl0034.jpg" width="400" height="250"/>
<img src="nssl0041.jpg" width="400" height="250"/>
</div>
</body>
</html>

自己添加图片

 

图片轮播

标签:idt   title   int   one   css   char   doctype   charset   pos   

原文地址:http://www.cnblogs.com/li-su-35/p/6032377.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!