ie6/7/8 firefox opera 图片无间隙滚动

 在网站也有很多案例了。在这边主要总结自己的问题。首先,先看下页面代码:

 

 

<!--下面是向右滚动代码-->
<div id="right" style="overflow:hidden;padding:10px 10px 0px 10px;width:900px;">
<table cellpadding="0" cellspacing="0" border="0" width="900px">
<tr>
<td id="right1" valign="top" align="center">
    <table id="te" style="width: 100%; border-collapse: collapse;" border="0" cellspacing="0">
                <tr>
                    <td style="width: 20%;" valign="top">
                    <a href="" target="_blank"><img src="rea_bak_files/20090519091944.JPG" alt="" width="90" border="0" height="90"></a>
                </td><td style="width: 20%;" valign="top">
                    <a href="" target="_blank"><img src="rea_bak_files/20090519092104.JPG" alt="" width="90" border="0" height="90"></a>
                </td><td style="width: 20%;" valign="top">
                    <a href="" target="_blank"><img src="rea_bak_files/20090519092118.JPG" alt="" width="90" border="0" height="90"></a>
                </td><td style="width: 20%;" valign="top">
                    <a href="" target="_blank"><img src="rea_bak_files/20090519092217.JPG" alt="" width="90" border="0" height="90"></a>
                </td><td style="width: 20%;" valign="top">
                    <a href="" target="_blank"><img src="rea_bak_files/20090519092234.JPG" alt="" width="90" border="0" height="90"></a>
                </td><td style="width: 20%;" valign="top">
                    <a href="" target="_blank"><img src="rea_bak_files/20090519092450.jpg" alt="" width="90" border="0" height="90"></a>
                </td>
                </tr>
            </table>
 </td>
<td id="right2" valign="top"></td>
</tr>
</table>
</div>
<script type="text/javascript">
var speed=30//速度数值越大速度越慢
document.getElementById("right2").innerHTML=document.getElementById("right1").innerHTML;
function Marquee(){
    if(document.getElementById("right").scrollLeft<=0)
        document.getElementById("right").scrollLeft+=document.getElementById("right2").offsetWidth;
    else{
        document.getElementById("right").scrollLeft--;
    }
}
var MyMar=window.setInterval(Marquee,speed);
document.getElementById("right").οnmοuseοver=function() {clearInterval(MyMar);};
document.getElementById("right").οnmοuseοut=function() {MyMar=setInterval(Marquee,speed);};
</script>
<!--向右滚动代码结束-->

 

 

1.在ie6与ie7/8 firefox opera

   要设置图片滚动的宽度

 

2.在firefox中采用document.getElementById("right2").innerhtml 而不是right2.innerhtml

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值