日期:2014-05-16 浏览次数:20427 次
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312">
<title></title>
<style>
ul,li { display:block; margin:0; padding:0; list-style-type:none;}
img { display:block; width:255px; height:120px;}
#focus { width:255px; height:120px; overflow:hidden; position:relative; }
</style>
</head>
<body>
<script>
window.onload = initAll;
function movel(thisli){
thisli.style.left = parseInt(thisli.style.left) - 255 + "px";
setTimeout("movel(thisli)",1000);
}
function initAll(){
var box = document.getElementById("focus");
var lis = box.getElementsByTagName("li");
for(var i=0; i<lis.length; i++){
lis[i].style.position = "absolute";
lis[i].style.top = 0 + "px";
lis[i].style.left = 255 * i + "px";
thisli = lis[i];
movel(thisli);
}
}
</script>
<ul id="focus">
<li><img src="Black.jpg" /></li>
<li><img src="Blue.jpg" /></li>
<li><img src="Yellow.jpg" /></li>
<li><img src="Purple.jpg" /></li>
</ul>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312">
<title></title>
<style>
ul,li { display:block; margin:0; padding:0; list-style-type:none;}
img { display:block; width:255px; height:120px;}
#focus { width:255px; height:120px; overflow:hidden; position:relative; }
</style>
</head>
<body>
<script>
window.onload = initAll;
var lis;
function movel(){
for(var i=0; i<lis.length; i++){
var thisli = lis[i];
thisli.style.left = parseInt(thisli.style.left) - 255 + "px";
if(parseInt(thisli.style.left) < 0)thisli.style.left = 255 * (lis.length - 1) + "px";
}
setTimeout("movel()",1000);
}
function initAll(){
var box = document.getElementById("focus");
lis = box.getElementsByTagName("li");
for(var i=0; i<lis.length; i++){
lis[i].style.position = "absolute";
lis[i].style.top = 0 + "px";
lis[i].style.left = 255 * i + "px";
}
movel();
}
</script>
<ul id="focus">
<li><img src="Black.jpg" /></li>
<li><img src="Blue.jpg" /></li>
<li><img src="Yellow.jpg" /></li>
&nb