中山php|最优网络中山做网站 中山php建站

最优良人

2012/05/29 at 11:38

文字图片向上滚动的JS代码

<div id="demo">
<div id="demo1">
<ul>

<li>
文字图片内容

 

</li>

</ul>
</div>
<div id="demo2"></div>

 

<script type="text/javascript">
var speed=10;
var FGDemo=document.getElementById('demo');
var FGDemo1=document.getElementById('demo1');
var FGDemo2=document.getElementById('demo2');
FGDemo2.innerHTML=FGDemo1.innerHTML
function Marquee1(){
if(FGDemo2.offsetHeight-FGDemo.scrollTop<=0)
FGDemo.scrollTop-=FGDemo1.offsetHeight
else{
FGDemo.scrollTop++
}
}
var MyMar1=setInterval(Marquee1,speed)
FGDemo.onmouseover=function() {clearInterval(MyMar1)}
FGDemo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</script>

</div>

标签:
-