【转载】一条一条滚动新闻条
<div id="limrq" style="overflow:hidden;height:20px;line-height:22px;">
<li>11111</li>
<li>22222</li>
<li>33333</li>
<li>44444</li>
<li>55555</li>
<li>66666</li>
<li>77777</li>
</div>
<script type="text/javascript">
var mrqInterval=new Object;
var mrqn;
var limrq=document.getElementById("limrq");
var lml=limrq.getElementsByTagName("li").length;
function liMarquee(){
limrq.scrollTop++;
if(limrq.scrollTop%22==0){
clearInterval(mrqInterval[0]);
}
}
function nxtmrq(){
if(mrqn<lml){
mrqInterval[0]=window.setInterval("liMarquee()",20);
mrqn++;
}
else{
limrq.scrollTop=0;
mrqn=0;
nxtmrq();
}
}
function intimrq(){
limrq.scrollTop=0;
mrqn=0;
mrqInterval[1]="";
clearInterval(mrqInterval[1]);
mrqInterval[1]=window.setInterval("nxtmrq()",2000);
}
limrq.innerHTML+="<li>"+limrq.getElementsByTagName("li")[0].innerHTML+"</li>";
limrq.onmouseover=function(){
clearInterval(mrqInterval[1]);
}
limrq.onmouseout=function(){
mrqInterval[1]=window.setInterval("nxtmrq()",2000);
}
window.onload=intimrq;
</script>