<div align="center" id="demo" style="overflow:hidden;height:200px;width:250px;border:1px solid #6699cc;font-size:14px;color:#336699;line-height:22px;text-align:left;padding:10px">
<div id="demo1">
無縫隙向上滾動,兼容IE和FF<br />
電腦軟硬件應用網<br />
網址:http://www.45it.com<br />
專注電腦學習
</div>
<div id="demo2"></div>
</div>
<script language="javascript" type="text/javascript">
<!--
var demo = document.getElementById("demo");
var demo1 = document.getElementById("demo1");
var demo2 = document.getElementById("demo2");
var speed=30; //滾動速度值,值越大速度越慢
var nnn=200/demo1.offsetHeight;
for(i=0;i<nnn;i++){demo1.innerHTML+="<br />"+ demo1.innerHTML}
demo2.innerHTML = demo1.innerHTML //克隆demo2為demo1
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0) //當滾動至demo1與demo2交界時
demo.scrollTop-=demo1.offsetHeight //demo跳到最頂端
else{
demo.scrollTop++ //如果是橫向的 將 所有的 height top 改成 width left
}
}
var MyMar = setInterval(Marquee,speed); //設置定時器
demo.onmouseover = function(){clearInterval(MyMar)} //鼠標經過時清除定時器達到滾動停止的目的
demo.onmouseout = function(){MyMar = setInterval(Marquee,speed)} //鼠標移開時重設定時器
-->
</script>