论坛's Archiver

发表于 2008-4-4 00:12

文字滚动效果广泛用在公告版块上,最具名的就是&lt;marquee&gt;标记了,但是在firefox中好像不支持,很多的javascript实现的复杂的文字滚动效果在IE下可以正常实现效果,但是在firefox下就不行了,不知道有没有在firefox和IE都可以兼容的文字滚动效果的实现方法.<br /><br />网上很多的地方说可以在IE和firefox下兼容的javascripr代码,经过我的实际检查都不行,比如下面的代码有网友说在firefox和IE下都可以实现效果,但是我在Firefox3beta4下却无法实现效果,不知道有没有什么办法解决这个问题?谢谢!<br /><br /><br />&lt;&#33;DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />&lt;head&gt;<br />&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;<br />&lt;title&gt;a&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />&#60;script type=&quot;text/javascript&quot;&gt;<br />function scrollinglivelist(divlist){<br />        list = eval(divlist);<br />        if(list[vtvi].style.pixelTop == 1){<br />                list[0].style.pixelTop -= num;<br />                list[1].style.pixelTop -= num;<br />                setTimeout(&quot;scrollinglivelist(list)&quot;, waitingtime);<br />                tvi = (tvi &lt; liveitems.length - 1) ? tvi+1 : 0 ;<br />                if(vtvi == 0){<br />                        vtvi = 1;<br />                        list[1].style.pixelTop = scrollerheight;<br />                        list[1].innerHTML = (tvi &lt; liveitems.length) ? liveitems[tvi] : liveitems[0];<br />                }else{<br />                        vtvi = 0;<br />                        list[0].style.pixelTop = scrollerheight;<br />                        list[0].innerHTML = (tvi &lt; liveitems.length) ? liveitems[tvi] : liveitems[0];<br />                }                       <br />        }else{<br />                list[0].style.pixelTop -= num;<br />                list[1].style.pixelTop -= num;<br />                setTimeout(&quot;scrollinglivelist(list)&quot;, scrollspeed);<br />        }<br />}<br />function startlivelist(){<br />        livelist[0].innerHTML = liveitems[tvi];<br />        scrollinglivelist(livelist);<br />}<br />var num = 1;<br />var waitingtime = 3000;<br />var scrollspeed = 50;<br />var scrollerheight = 100;<br />var tvi = 0;<br />var vtvi = 0;<br />var liveitems = new Array();<br />liveitems[0]=&quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&quot;<br />liveitems[1]=&quot;bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&quot;<br />&lt;/script&gt;<br />&lt;div style=&quot;position: absolute; top: 1px; left: 1px; width: 150px; height: 100px; z-index: 1;&quot;&gt;<br />&lt;div id=livelist style=&quot;position: absolute; top: 1px; left: 1px; width: 150px; visibility: visible;&quot;&gt;<br />&#60;script type=&quot;text/javascript&quot;&gt;<br />document.write(liveitems[0]);<br />&lt;/script&gt;<br />&lt;/div&gt;<br />&lt;div id=livelist style=&quot;position: absolute; top: 1px; left: 1px; width: 150px; visibility: visible;&quot;&gt;&lt;/div&gt;<br />&lt;/div&gt;<br />&#60;script type=&quot;text/javascript&quot;&gt;<br />startlivelist();<br />&lt;/script&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;

Whistler 发表于 2008-4-7 17:34

Fx 应该可以用 marquee 的:<br /><a href="http://developer.mozilla.org/en/docs/HTML:Element:marquee" target="_blank">http://developer.mozilla.org/en/docs/HTML:Element:marquee</a><br /><br />如果不行的话,试一试把 DOCTYPE 去掉以启用 quirks 模式

Meteor 发表于 2008-5-6 19:21

<!--quoteo(post=121755:date=2008年4月4日 0&#58;12:name=星)--><div class='quotetop'>引用 (星 @ 2008年4月4日 0&#58;12) <a href="index.php?act=findpost&pid=121755"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->文字滚动效果广泛用在公告版块上,最具名的就是&lt;marquee&gt;标记了,但是在firefox中好像不支持,很多的javascript实现的复杂的文字滚动效果在IE下可以正常实现效果,但是在firefox下就不行了,不知道有没有在firefox和IE都可以兼容的文字滚动效果的实现方法.<br /><br />网上很多的地方说可以在IE和firefox下兼容的javascripr代码,经过我的实际检查都不行,比如下面的代码有网友说在firefox和IE下都可以实现效果,但是我在Firefox3beta4下却无法实现效果,不知道有没有什么办法解决这个问题?谢谢!<br /><br /><br />&lt;&#33;DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />&lt;head&gt;<br />&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;<br />&lt;title&gt;a&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />&#60;script type=&quot;text/javascript&quot;&gt;<br />function scrollinglivelist(divlist){<br />        list = eval(divlist);<br />        if(list[vtvi].style.pixelTop == 1){<br />                list[0].style.pixelTop -= num;<br />                list[1].style.pixelTop -= num;<br />                setTimeout(&quot;scrollinglivelist(list)&quot;, waitingtime);<br />                tvi = (tvi &lt; liveitems.length - 1) ? tvi+1 : 0 ;<br />                if(vtvi == 0){<br />                        vtvi = 1;<br />                        list[1].style.pixelTop = scrollerheight;<br />                        list[1].innerHTML = (tvi &lt; liveitems.length) ? liveitems[tvi] : liveitems[0];<br />                }else{<br />                        vtvi = 0;<br />                        list[0].style.pixelTop = scrollerheight;<br />                        list[0].innerHTML = (tvi &lt; liveitems.length) ? liveitems[tvi] : liveitems[0];<br />                }                       <br />        }else{<br />                list[0].style.pixelTop -= num;<br />                list[1].style.pixelTop -= num;<br />                setTimeout(&quot;scrollinglivelist(list)&quot;, scrollspeed);<br />        }<br />}<br />function startlivelist(){<br />        livelist[0].innerHTML = liveitems[tvi];<br />        scrollinglivelist(livelist);<br />}<br />var num = 1;<br />var waitingtime = 3000;<br />var scrollspeed = 50;<br />var scrollerheight = 100;<br />var tvi = 0;<br />var vtvi = 0;<br />var liveitems = new Array();<br />liveitems[0]=&quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&quot;<br />liveitems[1]=&quot;bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&quot;<br />&lt;/script&gt;<br />&lt;div style=&quot;position: absolute; top: 1px; left: 1px; width: 150px; height: 100px; z-index: 1;&quot;&gt;<br />&lt;div id=livelist style=&quot;position: absolute; top: 1px; left: 1px; width: 150px; visibility: visible;&quot;&gt;<br />&#60;script type=&quot;text/javascript&quot;&gt;<br />document.write(liveitems[0]);<br />&lt;/script&gt;<br />&lt;/div&gt;<br />&lt;div id=livelist style=&quot;position: absolute; top: 1px; left: 1px; width: 150px; visibility: visible;&quot;&gt;&lt;/div&gt;<br />&lt;/div&gt;<br />&#60;script type=&quot;text/javascript&quot;&gt;<br />startlivelist();<br />&lt;/script&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<!--QuoteEnd--></div><!--QuoteEEnd--><br />好长的代码,有空在我的电脑里试试

ragnarose 发表于 2008-5-8 13:36

<a href="http://www.developer.ps/moo/mooquee/" target="_blank">http://www.developer.ps/moo/mooquee/</a>

mnop312 发表于 2008-12-8 18:36

木屑机 泉州贸易网 供求信息

**** 作者被禁止或删除 内容自动屏蔽 ****

页: [1]

© 2004-2009 Mozest.com