求助高手帮我查一下,为什么我这个无缝滚动不能实现一直循环啊?
<div id="demo" style="overflow:hidden;height:230px;width:424"> <div id="demo1">
<?php
while($DB->getrows()){
echo "<table><tr height=5><td width=230><a href=detail.php?id=".$DB->rows['newsid'].">".$DB->rows['newstitle']."</a></td></tr></table>";
}
?>
</div>
<div id="demo2">
</div>
</div>
<script>
var speed=10;
var demo2=document.getElementById("demo2");
var demo1=document.getElementById("demo1");
var demo=document.getElementById("demo");
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight;
else{
demo.scrollTop++;
}
}
var MyMar=setInterval(Marquee,speed);
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>