<base href="http://image2.sina.com.cn/gm/lineage2/whz/newwh/images/fy/images/images/ifimage/">
向上
<div id=demo style="overflow:hidden; 128px; height:300px;">
<div id=demo1>
<img src="gfjs.gif"><br><img src="bxtt.gif"><br><img src="bzjd.gif"><br>
</div>
<div id=demo2></div>
</div>
<script language="javascript">
var speed=30
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>
向下
<div id=demo3 style="overflow:hidden; 128px; height:300px;">
<div id=demo4>
<img src="gfjs.gif"><br><img src="bxtt.gif"><br><img src="bzjd.gif"><br>
</div>
<div id=demo5></div>
</div>
<script language="javascript">
var speed=30
demo5.innerHTML=demo4.innerHTML
demo3.scrollTop=demo3.scrollHeight
function Marquee(){
if(demo3.scrollTop<=0)
demo3.scrollTop+=demo5.offsetHeight
else{
demo3.scrollTop--
}
}
var MyMar=setInterval(Marquee,speed)
demo3.onmouseover=function() {clearInterval(MyMar)}
demo3.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
向左
<div id=demo6 style="overflow:hidden;height:100px;300px;"><table align=left
cellpadding=0 cellspace=0 border=0><tr><td id=demo7 valign=top><img src="gfjs.gif"><img
src="bxtt.gif"><img src="bzjd.gif"></td><td id=demo8 valign=top></td></tr></table></div>
<script>
var speed=30
demo8.innerHTML=demo7.innerHTML
function Marquee(){
if(demo8.offsetWidth-demo6.scrollLeft<=0)
demo6.scrollLeft-=demo7.offsetWidth
else{
demo6.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo6.onmouseover=function() {clearInterval(MyMar)}
demo6.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
向右
<div id=demo9 style="overflow:hidden;height:100px;300px;"><table align=left
cellpadding=0 cellspace=0 border=0><tr><td id=demo10 valign=top><img src="gfjs.gif"><img
src="bxtt.gif"><img src="bzjd.gif"></td><td id=demo11 valign=top></td></tr></table></div>
<script>
var speed=30
demo11.innerHTML=demo10.innerHTML
demo9.scrollLeft=demo9.scrollWidth
function Marquee(){
if(demo9.scrollLeft<=0)
demo9.scrollLeft+=demo11.offsetWidth
else{
demo9.scrollLeft--
}
}
var MyMar=setInterval(Marquee,speed)
demo9.onmouseover=function() {clearInterval(MyMar)}
demo9.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
在左右滚动的时候,不能把里面滚动区域的代码定义成div的而要用table,因为div定义左右位置时比较困难。这是我总结。 不知是否是这样。 我用了div 滚动总是有问题。