<div id="dome"> <div id="dome1"> <ul class="express"> {dede:arclist row='10' titlelen='36' orderby='pubdate' typeid='2' idlist=''} <li>·<a href="[field:arcurl/]"><font color="#666666">[field:textlink/]([field:pubdate function=MyDate('m-d',@me)/])</font></a></li> {/dede:arclist} </ul> </div> <div id="dome2"></div> </div>
上面是HTML代码,下面是js代码
<script type="text/javascript"> var dome=document.getElementById("dome"); var dome1=document.getElementById("dome1"); var dome2=document.getElementById("dome2"); var speed=50;//设置向上轮动的速度 dome2.innerHTML=dome1.innerHTML;//复制节点 function moveTop(){ if(dome1.offsetHeight-dome.scrollTop<=0){ dome.scrollTop=0; }else { dome.scrollTop++; } } var myFunction=setInterval("moveTop()",speed); dome.onmouseover=function(){ clearInterval(myFunction); } dome.onmouseout=function(){ myFunction=setInterval(moveTop,speed); } </script>