标签:style box osi bsp text pre ati css one
<!doctype html>
<html>
<head>
<title> </title>
<style type="text/css">
#box{
width:950px;
height:500px;
overflow:hidden;
position:relative;
left:0;
top:0;
}
#box #mylist{
position:absolute;
left:0;
top:0
list-style-type: none;
}
#box ul li{
float: left;
}
</style>
</head>
<body>
<div id="box">
<ul id="mylist">
<li><a><img src="../images/slider-1.jpg"></a></li>
<li><a><img src="../images/slider-2.jpg"></a></li>
<li><a><img src="../images/slider-3.jpg"></a></li>
</ul>
</div>
<script type="text/javascript" >
var timer=setInterval("hello()",2000);
var mylist=document.getElementById("mylist");
var num=document.getElementById("mylist").getElementsByTagName("li");
var now=0;
var left=0;
function hello(){
// body...
// document.write("ddd"+now);
if (left<=-(num.length-1)*950) {
now=0;
left=-now*950;
mylist.style.left=left+"px";
now=now+1;
}else{
left=-now*950;
mylist.style.left=left+"px";
now=now+1;
}
}
</script>
</body>
</html>
标签:style box osi bsp text pre ati css one
原文地址:http://www.cnblogs.com/xingxing88/p/5990579.html