日期:2014-05-17  浏览次数:20986 次

IE中可以实现移动效果的代码,在firefox中无法实现,改如何处理?
主要原因是ASP使用的标准是<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


代码如下: 
 <div id=demo style="overflow:hidden;width:725px;" align="center">
  <table width="725px" border=0 align=center cellpadding=0 cellspacing=0 cellspace=0>
  <tr>
  <td width="725px" valign=top id=marquePic1 style= "white-space:nowrap;overflow:hidden;text-overflow: ellipsis; "><table border='0' cellspacing='0' width="725px">
  <tr>
  <td align=center bgcolor="999900"><a href='hhf.html' target="_blank"><img src="image/rooms/豪华大床房.jpg" border=0 width="200px" height="120px" /><br />
  <br />
  豪华大床房</a></td>
  <td align=center bgcolor="999900"><a href='hhtf.html' target="_blank"><img src="image/rooms/豪华套房.jpg" border=0 width="200px" height="120px" /><br />
  <br />
  豪华套房</a></td>
  <td align=center bgcolor="999900"><a href='xzhh.html' target="_blank"><img src="image/rooms/行政豪华大床房.jpg" border=0 width="200px" height="120px" /><br />
  <br />
  行政豪华大床房</a></td>
  <td align=center bgcolor="999900"><a href='xztf.html' target="_blank"><img src="image/rooms/行政豪华套房.jpg" border=0 width="200px" height="120px" /><br />
  <br />
  行政豪华套房</a></td>
  </tr>
  </table></td>
  <td id=marquePic2 valign=top></td>
  </tr>
  </table>
  </div>
  <script type="text/javascript">
var speed=20
marquePic2.innerHTML=marquePic1.innerHTML
function Marquee(){
if(demo.scrollLeft>=marquePic1.scrollWidth){
demo.scrollLeft=0
}else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>



以上情况下应该怎么修改才能让代码在firefox下也能实现图片移动???

------解决方案--------------------
<script type="text/javascript">
var speed=20
marquePic2=document.getElementById("marquePic2");
marquePic1=document.getElementById("marquePic1");
demo=document.getElementById("demo");
function Marquee(){
if(demo.scrollLeft>=marquePic1.scrollWidth){
demo.scrollLeft=0
}else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>

把代码改成这样就可以了