MARQUEE 滚动效果,含有MARQUEE的页面在 在firefox下也能运行?!及不能运行的解决方法

来源:互联网 发布:淘宝网店数量 编辑:程序博客网 时间:2024/05/21 05:59
修订 by jackpk:
20100524: 发现最新版本的firefox(3.6.3)对MARQUEE 滚动效果支持得很好,而我先前使用的firefox3.0版本就存在对MARQUEE 支持不好的问题。
MARQUEE 滚动效果
url:http://bbs.blueidea.com/thread-2850370-1-1.html
 
·可以设置是否响应鼠标暂停
·可以设置滚动滚动方向
·可以设置滚动速度
·图文支持
    。。。


marquee在firefox下,时滚时不滚的解决方法
本文来自: PQ秀秀网(http://www.pqshow.com) 详细出处参考:http://www.pqshow.com/design/jiqiao/200909/10288.html
marquee是个好东西啊
可惜firefox对他的支持不够好

marquee在firfox下有时候滚动,有时候不滚动..
这是最令人头疼的事情
要不然不滚,要不然滚,这个问题可能就更容易解决

有很多js脚本可以模拟滚动

不过发现的最简单的办法是
把marquee的标签放在js里面。。。。。。。


<script language=javascript>
<!--
function marquee_start()
{
document.write("<marquee id='_dstid_MsgTitleMq' loop='-1' scrollamount='1' behavior='scroll' >")
}
function marquee_end()
{
document.write("</marquee>")
}
// -->
</script>
<script language=JavaScript>marquee_start();</script>
AaBbCc
<script language=JavaScript>marquee_end();</script>


遇到此类问题,可以这样解决看看。

测试:ie6/ie7/firefox


本文来自: PQ秀秀网(http://www.pqshow.com) 详细出处参考:http://www.pqshow.com/design/jiqiao/200909/10288.html

 

 

 

 

无间断滚动的新闻文章列表,兼容IE、Firefox和Opera,符合W3C标准。可作Marquee
详细出处参考:http://www.jb51.net/article/10060.htm

 

 

 

 

 

firefox 2 marquee兼容

url:http://cai555.javaeye.com/blog/260584

2008 - 10 - 31


新作的项目里面有个页面用到了<marquee>标签结果,在firefox下面就是不工作。无奈写了一段代码,用来替代简单的marquee功能:

 

Js代码 复制代码
  1. /*  
  2.  * parameter: el -- marquee element  
  3.  *   
  4.  * html structure:  
  5.  * <div ...>  
  6.  *  <marquee ...>  
  7.  *      <table width="770px"...>  
  8.  */   
  9. Marquee =  function (el){   
  10.     el.parentNode.style.overflow =  "hidden" ;   
  11.     el.parentNode.style.position =  "relative" ;   
  12.        
  13.      var  tab = el.getElementsByTagName( "table" )[0];   
  14.     el.parentNode.appendChild(tab);   
  15.     el.parentNode.removeChild(el);   
  16.     el = tab;   
  17.     el.style.position =  "absolute" ;   
  18.     el.style.left =  "0px" ;   
  19.        
  20.     pfun =  this ;   
  21.        
  22.      this .pauseflag =  false ;   
  23.     el.onmouseover =  function (){pfun.pause()};   
  24.     el.onmouseout =  function (){pfun.resume()};   
  25.        
  26.      this .direction = -1;   
  27.        
  28.      this .timer = window.setInterval( function (){   
  29.          if (!pfun.pauseflag){   
  30.              var  left = parseInt(el.style.left);   
  31.                
  32.              /*  
  33.              * table 里总共有10张图片一字排开,  
  34.              * 长度770px,这里使用540px,  
  35.              * 原因是考虑到最后3幅图片不能全部飞过,  
  36.              * 否则会有一段间隙显示空白  
  37.              */   
  38.              if (left < 0 && left <= -540){   
  39.                 pfun.direction = 1   
  40.             } else   if (left >= 0){   
  41.                 pfun.direction = -1;   
  42.             }   
  43.             el.style.left = (left + (5*pfun.direction))+ "px" ;   
  44.         }   
  45.     }, 200);   
  46. }   
  47.   
  48. Marquee.prototype = {   
  49.     pause :  function (){   
  50.          this .pauseflag =  true ;   
  51.     },   
  52.        
  53.     resume :  function (){   
  54.          this .pauseflag =  false ;   
  55.     }   
  56. }   
  57.   
  58. /*  
  59.  * check is firefox 2.x  
  60.  */   
  61. if  (/Firefox[///s](/d+/./d+)/.test(navigator.userAgent)){   
  62.      var  ffversion= new  Number(RegExp.$1)  // capture x.x portion and store as a number   
  63.       if  (ffversion>=2 && ffversion <= 3){   
  64.           var  els = document.getElementsByTagName( "marquee" );   
  65.           for ( var  i = 0 ; i < els.length; i++)   
  66.               new  Marquee(els[i]);   
  67.      }   
  68. }  

 HTML代码:

Html代码 复制代码
  1. ...   
  2. </ marquee >   
  3. < script   type = "text/javascript"   src = "js/marquee.js" > </ script >   
 

 

 

 

 

 

 

 

 

 

marquee 详解!

url:http://www.pqshow.com/design/jiqiao/200909/10289.html

 

首先让我们认识这个<marquee>标签,它是成对出现的标签,首标签<marquee>和尾标签</marquee>之间的内容就是滚动内容。<marquee>标签的属性主要有behavior、bgcolor、direction、width、height、hspace、vspace、loop、scrollamount、scrolldelay等,它们都是可选的。

behavior属性

behavior属性的参数值为alternate、scroll、slide中的一个,分别表示文字来回滚动、单方向循环滚动、只滚动一次,需要注意的是:如果在<marquee>标签中同时出现了direction和behavior属性,那么scroll和slide的滚动方向将依照direction属性中参数的设置。

<marquee behavior="alternate">我来回滚动</marquee>
<marquee behavior="scroll">我单方向循环滚动</marquee><marquee behavior="scroll" direction="up" height="30">我改单方向向上循环滚动</marquee> <marquee behavior="slide">我只滚动一次</marquee>
<marquee behavior="slide" direction="up">我改向上只滚动一次了</marquee>
bgcolor属性文字滚动范围的背景颜色,参数值是16进制(形式:#AABBCC或#AA5566等)或预定义的颜色名字(如red、yellow、blue等)。如下所示:<marquee behavior=="slide" direction="left" bgcolor="red">我的背景色是红色的</marquee>


direction属性

  文字滚动的方向,属性的参数值有down、left、right、up共四个单一可选值,分别代表滚动方向向下、向左、向右、向上。如下所示:

<marquee direction="right">我向右滚动</marquee>

<marquee direction="right">我向下滚动</marquee>

width和height属性

  width和height属性的作用决定滚动文字在页面中的矩形范围大小。width属性用以规定矩形的宽度,height属性规定矩形的高度。这两个属性的参数值可以是数字或者百分数,数字表示矩形所占的(宽或高)像素点数,百分数表示矩形所占浏览器窗口的(宽或高)百分比。如下所示:

  <marquee width="300" height="30" bgcolor="red">我宽300像素,高30像素。</marquee>
hspace和vspace属性

  这两个属性决定滚动矩形区域距周围的空白区域.

<marquee width="300" height="30" vspace="10" hspace="10" bgcolor="red">我矩形边缘水平和垂直距周围各10像素。</marquee>


<marquee width="300" height="30" vspace="50" hspace="50" bgcolor="red">我矩形边缘水平和垂直距周围各50像素。</marquee>
loop属性

  loop属性决定滚动文字的滚动次数,缺省是无限循环。参数值可以是任意的正整数,如果设置参数值为-1或infinite时将无限循环。如下所示:

  <marquee loop="2">我滚动2次。</marquee>
<marquee loop="infinite">我无限循环滚动。</marquee>

<marquee loop="-1">我无限循环滚动。</marquee>

scrollamount和scrolldelay属性

  这两个属性决定文字滚动的速度(scrollamount)和延时(scrolldelay),参数值都是正整数。如下所示:

<marquee scrollamount="100">我速度很快.</marquee>

<marquee scrollamount="50">我慢了些。</marquee>
<marquee scrolldelay="30">我小步前进。</marquee>
<marquee scrolldelay="1000" scrollamount="100">我大步前进。</marquee>
最后说一下align属性,这个属性决定滚动文字位于距形内边框的上下左右位置。您也可以将<marquee>和</marquee>之间的内容替换为图像或其它对象等