想制作这样的效果文字左右滚动  ,当最后的文字也滚动入容器后,由最前面的文字补到最后,即循环的效果
html代码如<html>
<a>文字</a>
<a>文字</a>
<a>文字</a>
...
</html>
谢谢

解决方案 »

  1.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
    <div id="demo" style="overflow:hidden;height:100px;width:200px;">
    <table cellpadding="0" cellspace="0" border="0">
    <tr>
    <td id="demo1"><table width="200" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>一</td>
          <td>二</td>
          <td>三</td>
        </tr>
    </table></td>
    <td id="demo2"></td>
    </tr>
    </table>
    </div>
    <script>
    var speed=30
    var MyMar=setInterval(Marquee,speed)
    demo2.innerHTML=demo1.innerHTML
    demo.onmouseover=function() {clearInterval(MyMar)}
    demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
    function Marquee(){
    if(demo2.offsetWidth-demo.scrollLeft<=0)
       demo.scrollLeft-=demo1.offsetWidth
    else{
       demo.scrollLeft++
    }
    }
    </script>
    </body>
    </html>
      

  2.   


    这个怎么对ff不兼容  招了半天的原因把html开头的声明   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">去掉才好使     这是怎么回事求一个  兼容各种浏览器的  js或jquery代码
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title> new document </title>
    <link href="css-1.css" rel="stylesheet" type="text/css" />
    </head><body>
    <div id="demo" style="overflow:hidden;height:100px;width:200px;">
    <table cellpadding="0" cellspace="0" border="0">
    <tr>
    <td id="demo1"><table width="200" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>一</td>
          <td>二</td>
          <td>三</td>
        </tr>
    </table></td>
    <td id="demo2"></td>
    </tr>
    </table>
    </div>
    <script>
    var speed=30
    var MyMar=setInterval(Marquee,speed)
    document.getElementById('demo2').innerHTML=document.getElementById('demo1').innerHTML
    document.getElementById('demo').onmouseover=function() {clearInterval(MyMar)}
    document.getElementById('demo').onmouseout=function() {MyMar=setInterval(Marquee,speed)}
    function Marquee(){
    if(document.getElementById('demo2').offsetWidth-document.getElementById('demo').scrollLeft<=0)
       document.getElementById('demo').scrollLeft-=document.getElementById('demo1').offsetWidth
    else{
       document.getElementById('demo').scrollLeft++
    }
    }
    </script></body></html>
    这样就OK了~·
      

  4.   

    我也是这样的就是这两句<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    ...
    只有把第一句去掉了才行但去掉这行   能滚动了   其他样式都变了
      

  5.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">  
    不用去掉这些火狐,ie都没问题~·
      

  6.   


    原来是这样ff不能直接用id啊ff毛病真多  老多代码就它不能使非常感谢
      

  7.   

    http://jscroller2.usbordihn.de/example/