<table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td class="newdongtai" align="left">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td width="229" class="newdongtai" align="left">
                                                    合作伙伴</td>
                                                <td width="50" class="more_ico">
                                                    <a href="partner.aspx">
                                                        <img src="images/more.jpg" width="37" height="13" border="0" /></a></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" ><div id="hdemo" style="overflow:hidden; width:280px;">
                                   <table  cellpadding="0" cellspace="0" border="0" width="100%"><tr><td id="hdemo1" style=" height:42px;">
                                     <a href="#" target="_blank">
                                            <img src="images/huoban.gif" width="113" height="42" border="0" class="partner border" /></a>
                                            <a href="#" target="_blank">
                                            <img src="images/huoban1.gif" width="113" height="42" border="0" class="partner border" /></a>
                                           </td> <td id="hdemo2" valign="top"></td></tr></table></div>
                                                  
                                       </td>
                                </tr>
                            </table>
                             <script type="text/javascript">
var Picspeed=15
hdemo2.innerHTML=hdemo1.innerHTML
function Marquee1(){
if(hdemo2.offsetWidth-hdemo.scrollLeft<=0)
hdemo.scrollLeft-=hdemo1.offsetWidth
else{
hdemo.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,Picspeed)
hdemo.onmouseover=function() {clearInterval(MyMar1)}
hdemo.onmouseout=function() {MyMar1=setInterval(Marquee1,Picspeed)}
</script> 
运行之后,图片没有滚动,只是在hdemo2里写入了hdemo1的内容,结果就成了两行显示,不知道为什么,请高手指教!!

解决方案 »

  1.   

    hdemo1要写成
    document.getElementById("hdemo1")其他类似
      

  2.   

    正确的
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="newdongtai" align="left">
          <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="229" class="newdongtai" align="left">
                合作伙伴
              </td>
              <td width="50" class="more_ico">
                <a href="partner.aspx">
                  <img src="images/more.jpg" width="37" height="13" border="0" /></a>
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td align="center">
          <div id="hdemo" style="overflow: hidden; width: 280px;">
            <table cellpadding="0" cellspace="0" border="0" width="100%">
              <tr>
                <td id="hdemo1" style="height: 42px;">
                  <nobr>
    <a href="#" target="_blank">
    <img src="images/huoban.gif" width="113" height="42" border="0" class="partner border" /></a>
    <a href="#" target="_blank">
    <img src="images/huoban1.gif" width="113" height="42" border="0" class="partner border" /></a>
    </nobr>
                </td>
                <td id="hdemo2" valign="top">
                </td>
              </tr>
            </table>
          </div>
        </td>
      </tr>
    </table>
    <script type="text/javascript">
      var Picspeed = 15
      hdemo1 = document.getElementById("hdemo1")
      hdemo2 = document.getElementById("hdemo2")
      hdemo2.innerHTML = hdemo1.innerHTML
      function Marquee1() {
        if (hdemo2.offsetWidth - hdemo.scrollLeft <= 0)
          hdemo.scrollLeft -= hdemo1.offsetWidth
        else {
          hdemo.scrollLeft++
        }
      }
      var MyMar1 = setInterval(Marquee1, Picspeed)
      hdemo.onmouseover = function () { clearInterval(MyMar1) }
      hdemo.onmouseout = function () { MyMar1 = setInterval(Marquee1, Picspeed) }
    </script>
      

  3.   

     hdemo1 = document.getElementById("hdemo1")
      hdemo2 = document.getElementById("hdemo2")
    还得加上var 不然不会滚动,会出现对象不支持此属性
      

  4.   

    怎么这么严格 呀!唉,谢谢net_lover了,问题解决了