部分代码如下:<script language="javascript">
<!--
  var speed=30;
  document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML;
  document.getElementById("demo").scrollLeft=document.getElementById("demo").scrollWidth;
  function Marquee(){
  if(document.getElementById("demo").scrollLeft<=0)
     document.getElementById("demo").scrollLeft+=document.getElementById("demo2").offsetWidth;
  else{
     document.getElementById("demo").scrollLeft--;
  }
  }
  var MyMar=setInterval(Marquee,speed);
  document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)};
  document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)};
  -->
</script><body bgcolor="#84b46a" leftmargin="0" topmargin="0">  
<div>
  <table width="800" height="500" align="center" border="0" cellpadding="0" cellspacing="0">
     <tr>
   <td valign="top" background="images/inner_bg.jpg">
     <table width="800" border="0" cellpadding="0" cellspacing="0">
           <tr>
     <td background="images/inner_bg.jpg">
               <table>
     <tr>
   <td width="251" height="82" align="center"></td>
   <td width="537"><img src="images/inner_title.GIF" width="500" height="80"></td>
 </tr>
   </table>
 </td>
   </tr>
 </table>
 <table height="300" border="0" cellpadding="0" cellspacing="0">
 
 </table>
 <table align="center" height="100" border="0" cellpadding="0" cellspacing="0">
 <tr><td>
   <div id="demo" style="overflow:hidden;height:33;width:500;background:#214984;color:#ffffff">
             <table align="center" cellpadding="0" cellspace="0" border="0">
               <tr>
                 <td id="demo1" valign="top">
                   <img src="images/link/flashempire.gif">
                   <img src="images/linklogo/shlogo.gif">
                   <img src="images/link/deskcity.gif">
                   <img src="images/linklogo/5dmeng.gif">
                   <img src="http://www.blueidea.com/logo.gif">
                   <img src="images/link/flashskylogo.gif">
                   <img src="images/link/5dlogo88.gif">
                   <img src="http://www.yiiboo.com/cgercn/link.gif">
                   <img src="images/flash8.gif">
                 </td>
                 <td id="demo2" valign="top">
         </td>
               </tr>
         </table>
           </div>
         </td></tr>
 </table>  
       </td>
 </tr>
  </table>
  </div>
但是我运行了以后,只能出现一行静止的图片,图片组无法实现跑马灯效果,但是如果把相应的<div>和JS代码单独考到一个空文件中,就可以正常运行了……不知道是什么问题?请各位高手指教!小弟不胜感激!

解决方案 »

  1.   

    furebug下报错吗?在空文件夹下可以,就有可能是因为你的标签有的id是重复的
      

  2.   

    把其中2句改下,运行看效果,看能自己弄明白原理不?
    <div id="demo" style="overflow:scroll;height:33;width:500;background:#214984;color:#ffffff">
      <table align="center" cellpadding="0" cellspace="0" border="1">
      

  3.   

    如果不想弄清楚程序实现原理的话当俺没说……确定图片宽度足够?
    <td id="demo1" valign="top" width="501">
      

  4.   

    document.getElementById("demo").scrollLeft  的值 一直就没变过. 0
      

  5.   

    <div id="demo" style="overflow:hidden;height:33;width:297;background:#214984;color:#ffffff">
      <table align="center" cellpadding="0" cellspace="0" border="0" width="500">
      <tr>
      <td id="demo1" valign="top">
      <img src="images/link/flashempire.gif">
      <img src="images/linklogo/shlogo.gif">
      <img src="images/link/deskcity.gif">
      <img src="images/linklogo/5dmeng.gif">
      <img src="http://www.blueidea.com/logo.gif">
      <img src="images/link/flashskylogo.gif">
      <img src="images/link/5dlogo88.gif">
      <img src="http://www.yiiboo.com/cgercn/link.gif">
      <img src="images/flash8.gif">
      </td>
      <td id="demo2" valign="top">
    </td>
      </tr>
    </table>
      </div>