分享一个自己写的小代码片段,CSDN首页有的一个效果 http://community.csdn.net/Expert/topic/4784/4784944.xml?temp=.3543817

解决方案 »

  1.   

    <table>
    <TD height="5" class=text1><img src="images/tip4.gif" width="680" height="3"></TD>
        <TR vAlign=top> 
          <TD height="10" class=text1>TD>
        </TR>
        <TR vAlign=top> 
          <TD height="150" class=text1> 
            <div id="demo" style="overflow:hidden;width:670px;color:#ffffff;" align="center"> 
              <table border="0" align="center" cellpadding="0" cellspacing="0">
                <tr> 
                  <td id="demo1" valign="top" align="center"> <table height="120" border="0" cellpadding="2" cellspacing="0">
                      <tr align="center"> 
                        <td height="93"><img src="goodpic/ZXX-001.jpg" width="120" height="120"></td>
                        <td><img src="goodpic/ZXX-002.jpg" width="120" height="120"></td>
                        <td><img src="goodpic/ZXX-004.jpg" width="120" height="120"></td>
                        <td><img src="goodpic/ZXX-005.jpg" width="120" height="120"></td>
                        <td><img src="goodpic/ZXX-006.jpg" width="120" height="120"></td>
                        <td><img src="goodpic/ZXX-006.jpg" width="120" height="120"></td>
                      </tr>
                    </table></td>
                  <td id="demo2" valign="top"></td>
                </tr>
              </table>
              <script>
      var speed=1//速度数值越大速度越慢
      demo2.innerHTML=demo1.innerHTML
      function Marquee(){
      if(demo.scrollLeft<=0)
      demo.scrollLeft+=demo2.offsetWidth
      else{
      demo.scrollLeft--
      }
      }
      var MyMar=setInterval(Marquee,speed)
      demo.onmouseover=function() {clearInterval(MyMar)}
      demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
      </script>
            </div></TD>