求文字滚动JS代码

解决方案 »

  1.   

     <marquee  scrollamount="1" scrolldelay="80" direction="left">你要滚动的内容<marquee>
      

  2.   

    文字滚动是由<marquee></marquee>控制的。marquee的参数如下:1、方向 <direction=#> #=left, right
    如:<marquee direction=left>啦啦啦,我从右向左移!</marquee>
    <marquee direction=right>啦啦啦,我从左向右移!</marquee>2、方式 <bihavior=#> #=scroll, slide, alternate
    如:<marquee behavior=scroll>啦啦啦,我一圈一圈绕着走!</marquee>
    <marquee behavior=slide>啦啦啦,我只走一次就歇了!</marquee>
    <marquee behavior=alternate>啦啦啦,我来回走耶!</marquee>3、循环 <loop=#> #=次数;若未指定则循环不止(infinite)
    如:<marquee loop=3 width=50% behavior=scroll>啦啦啦,我只走 3 趟哟!</marquee>
    <marquee loop=3 width=50% behavior=slide>啦啦啦,我只走 3 趟哟!</marquee>
    <marquee loop=3 width=50% behavior=alternate>啦啦啦,我只走 3 趟哟!</marquee>4、速度 <scrollamount=#>
    如:<marquee scrollamount=20>啦啦啦,我走得好快哟!</marquee>5、延时 <scrolldelay=#>
    如: <marquee scrolldelay=500 scrollamount=100>啦啦啦,我走一步,停一停!</marquee>6、对齐方式(Align) <align=#> #=top, middle, bottom
    如:<font size=6>
    <marquee align=# width=400>啦啦啦,我会移动耶!</marquee>
    </font>
    7、底色 <bgcolor=#>
    #=rrggbb 16 进制数码,或者是下列预定义色彩:
    Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
    Fuchsia, White, Green, Purple, Silver, Yellow, Aqua如:<marquee bgcolor=aaaaee>啦啦啦,我会移动耶!</marquee>8、面积 <height=# width=#>
    如:<marquee height=40 width=50% bgcolor=aaeeaa> 啦啦啦,我会移动耶!</marquee>9、空白(Margins)<hspace=# vspace=#><marquee   id="scrollarea"   direction="up"   scrolldelay="10"   scrollamount="1"   width="150"   height="80"   onmouseover="this.stop();"   onmouseout="this.start();">
      

  3.   


    <SCRIPT>
    function MarqueeLinkBox(id, lh, speed, delay) {
           var o = document.getElementById(id);
           var p = false;
           var t;
           o.style.overflow = "hidden";
    o.style.height = o.style.lineHeight = lh + "px";
           o.style.lineHeight = "18px";
           o.style.height = o.style.lineHeight;
           o.onmouseover = function() { p = true; }
           o.onmouseout = function()  { p = false;}
           function start() {
                  t = setInterval(scrolling, speed);
                  if (!p) {o.scrollTop++;}
           }
           function scrolling() {
                  if ((o.scrollTop % lh) != 0) {
                         o.scrollTop++;
                         if (o.scrollTop >= o.scrollHeight - lh - 1) 
                         {
                           o.scrollTop = 0;
                         }
                  } else {
                         clearInterval(t);
                         setTimeout(start, delay);
                  }
           }
           setTimeout(start, delay);
    }
    </SCRIPT>
    <div id="DD">
     1111111111111111111111111<br />
     1231222222222222222222222<br />
     1112323232323232323232111<br />
    </div>
    <SCRIPT>MarqueeLinkBox("DD",18,10,2000);</SCRIPT>
      

  4.   

    marquee  这个只对IE有效吧。
      

  5.   

    没有依据的话不要说出来IE8,chrome2.0 ,firefox3.5,opera9.64,safari4.0.3下测试通过
      

  6.   

    <marquee  scrollamount="1" scrolldelay="80" onmouseover="this.stop()" onmouseout="this.start()" direction="left">你要滚动的内容 <marquee>
      

  7.   

    这有一个通用不间断滚动JS封装类,各式各样的文字滚动,图片滚动效果都有,挺全面的。
    http://www.abaonet.com/demo/codeR/d1816/MSClass.html