html加JS的无缝滚动技术
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
height: 150px;
text-align: center;
float: left;
}
#demo img {
display: block;
margin: 1px;
border-top-width: 1px;
border-right-width: 3px;
border-bottom-width: 3px;
border-left-width: 3px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #F2F2F2;
border-right-color: #FFFF00;
border-bottom-color: #F2F2F2;
border-left-color: #FFFF00;
}
-->
</style>
<div id="demo">
<div id="demo1">
<a href="#"><img src="bizhi/01.jpg" width="187"
height="137" border="1" /></a></p>
<a href="#"><img src="bizhi/02.jpg" width="187"
height="137" border="1" /></a></p>
<a href="#"><img src="bizhi/03.jpg" width="187"
height="137" border="1" /></a></p>
<div id="demo2"></div>
</div>
<script>
<!--
var speed=40; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML; //克隆demo1为demo2
function Marquee(){
if(tab2.offsetTop-tab.scrollTop<=0)//当滚动至demo1与demo2交界时
tab.scrollTop-=tab1.offsetHeight //demo跳到最顶端
else{
tab.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function()
{clearInterval(MyMar)};//鼠标移上时清除定时器达到滚动停止的目的
tab.onmouseout=function()
{MyMar=setInterval(Marquee,speed)};//鼠标移开时重设定时器
-->
</script>