FireFox,IE相容的無縫跑馬燈
<STYLE type=text/css>
#demo a {
width:100%;
overflow:hidden;
font:12px/16px tahoma;
display:block;
text-decoration:none;
margin:2px;
color:#4a551c;
padding-left:2px;
text-align:left;
}
#demo a:hover {
color:#ff6600;
}</STYLE>
</HEAD>
<body>
<div id=”demo” style=”overflow:hidden;height:100px;width:400px; overflow:hidden;”>
<div id=demo1>
<a href=”#” mce_href=”#”>完全相容IE, FF, Opera跑馬燈語法1</a>
<a href=”#” mce_href=”#”>完全相容IE, FF, Opera跑馬燈語法2</a>
<a href=”#” mce_href=”#”>完全相容IE, FF, Opera跑馬燈語法3</a>
</div>
<div id=demo2></div>
</div>
<script>
var speed=40
var demo=document.getElementById(“demo”);
var demo2=document.getElementById(“demo2”);
var demo1=document.getElementById(“demo1”);
demo2.innerHTML=demo1.innerHTML
demo2.innerHTML=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>
</body>
找了很久..終於有個FF及IE都支援的例子了…使用上沒什麼需要注意的!
唯一就是Div 中的超連結數量要多一點..要不然..如果div的height不夠高..那跑馬燈會不能動…那如果超連結不夠多..,可以加上下面的語法
demo2.innerHTML=demo2.innerHTML+demo1.innerHTML
這樣就可以用了