论坛首页 入门技术论坛

请问怎样修改才能让这段代码也能在Firefox中运行起来

浏览 2978 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-08-15  
请问怎样修改才能让这段代码也能在Firefox中运行起来,目前只能在IE中进行滚动。先谢啦!!!
xml 代码
xml 代码
  1. <!---->>  
  2. <html>  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
  5. <title>连续向上滚动title>  
  6. <style type="text/css">  
  7. <!---->
  8. body {   
  9.     font-size: 9pt;   
  10.     color: #000000;   
  11. }   
  12. a {   
  13.     color: #0000FF;   
  14.     text-decoration: none;   
  15. }   
  16. a:hover {   
  17.     color: #FF0000;   
  18.     text-decoration: underline;   
  19. }   
  20. -->  
  21. style>  
  22. head>  
  23.   
  24. <body>  
  25.   
  26. <div id="marquees">  
  27.   <a href="#">链接一a><br>  
  28.   <br>  
  29.   <a href="#">链接二a><br>  
  30.   <br>  
  31.   <a href="#">链接三a><br>  
  32.   <br>  
  33.   <a href="#">链接四a><br>  
  34.   <br>  
  35. div>    
  36. <script language="JavaScript">  
js 代码
js 代码
  1. marqueesHeight=200;   
  2. stopscroll=false;   
  3.   
  4. with(marquees){   
  5.   style.width=0;   
  6.   style.height=marqueesHeight;   
  7.   style.overflowX="visible";   
  8.   style.overflowY="hidden";   
  9.   noWrap=true;   
  10.   onmouseover=new Function("stopscroll=true");   
  11.   onmouseout=new Function("stopscroll=false");   
  12. }   
  13. document.write('<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');   
  14.   
  15. preTop=0; currentTop=0;    
  16.   
  17. function init(){   
  18.   templayer.innerHTML="";   
  19.   while(templayer.offsetHeight<marqueesHeight){   
  20.     templayer.innerHTML+=marquees.innerHTML;   
  21.   }   
  22.   marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;   
  23.   setInterval("scrollUp()",40);   
  24. }   
  25. document.body.onload=init;   
  26.   
  27. function scrollUp(){   
  28.   if(stopscroll==truereturn;   
  29.   preTop=marquees.scrollTop;   
  30.   marquees.scrollTop+=1;   
  31.   if(preTop==marquees.scrollTop){   
  32.     marquees.scrollTop=templayer.offsetHeight-marqueesHeight;   
  33.     marquees.scrollTop+=1;   
  34.   }   
  35. }  
xml 代码
  1. script>  
  2. body>  
  3. html>  
   发表时间:2007-08-15  
直接用<marquee>元素吧,FF也支持的
0 请登录后投票
   发表时间:2007-08-15  
直接用<marquee>元素不能够连接显示
会出现空白
0 请登录后投票
   发表时间:2007-08-15  
with(marquees){ 前面加上下面一句话看看

var marquees = document.getElementById("marquees");
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics