<html> 图片轮播图1 (自己记录使用)
没有滚动效果:一张张跳换
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>图片轮播</title>
<style type="text/css">
#tab{
overflow:hidden;
width:1000px;
height:800px;
position:relative;
float:left;
border:1px solid red;
}
#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';
},2000);
};
</script>
</head>
<body>
<div id="tab">
<img src="1.jpg" width="900px">
<img src="2.jpg" width="900px">
<img src="3.jpg" width="900px">
</div>
</body>
</html>