<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
#div1 {
overflow:hidden;
width: 800px;
margin-top:150px;
margin-left:600px;
}
#div1 img {
border: 3px solid #F2F2F2;
float:left;
width:200px;
height:200px;
}
#div2 {
float: left;
width: 800%;
}
#div3 {
float: left;
}
#div4 {
float: left;
}
</style>
<body>
<div id="div1">
<div id="div2">
<div id="div3">
<a href="#"><img src="1.jpg" border="0" /></a>
<a href="#"><img src="2.jpg" border="0" /></a>
<a href="#"><img src="3.jpg" border="0" /></a>
<a href="#"><img src="4.jpg" border="0" /></a>
<a href="#"><img src="5.jpg" border="0" /></a>
</div>
<div id="div4"></div>
</div>
</div>
</body>
<script type="text/javascript">
var speed=5;
var dong=document.getElementById("div1");
var ci=document.getElementById("div3");
var da=document.getElementById("div4");
da.innerHTML=ci.innerHTML;
function hanshu(){
if(da.offsetWidth-dong.scrollLeft<=0)
dong.scrollLeft=dong.scrollLeft-ci.offsetWidth
else{
dong.scrollLeft++;
}
}
var ting=setInterval(hanshu,speed);
dong.onmouseover=function() {clearInterval(ting)};
dong.onmouseout=function() {ting=setInterval(hanshu,speed)};
</script>
</html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
#div1 {
overflow:hidden;
width: 800px;
margin-top:150px;
margin-left:600px;
}
#div1 img {
border: 3px solid #F2F2F2;
float:left;
width:200px;
height:200px;
}
#div2 {
float: left;
width: 800%;
}
#div3 {
float: left;
}
#div4 {
float: left;
}
</style>
<body>
<div id="div1">
<div id="div2">
<div id="div3">
<a href="#"><img src="1.jpg" border="0" /></a>
<a href="#"><img src="2.jpg" border="0" /></a>
<a href="#"><img src="3.jpg" border="0" /></a>
<a href="#"><img src="4.jpg" border="0" /></a>
<a href="#"><img src="5.jpg" border="0" /></a>
</div>
<div id="div4"></div>
</div>
</div>
</body>
<script type="text/javascript">
var speed=5;
var dong=document.getElementById("div1");
var ci=document.getElementById("div3");
var da=document.getElementById("div4");
da.innerHTML=ci.innerHTML;
function hanshu(){
if(da.offsetWidth-dong.scrollLeft<=0)
dong.scrollLeft=dong.scrollLeft-ci.offsetWidth
else{
dong.scrollLeft++;
}
}
var ting=setInterval(hanshu,speed);
dong.onmouseover=function() {clearInterval(ting)};
dong.onmouseout=function() {ting=setInterval(hanshu,speed)};
</script>
</html>