这是一个文字向上滚动的例子,请问如何改成向下滚动?<!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=gb2312" /> 
  <title>文字向上滚动</title> 
  <style type="text/css"> 
   .box{width:500px; height:150px;line-height:25px; border:#bbb 1px solid; overflow:hidden;} 
   .box ul{margin:0; padding:0} 
   .box li{font-size:12px; } 
  </style> 
</head> <body> 
<div class="box" id="marqueebox0"> 
     <ul>
         <li>11111111</li>
         <li>22222222</li>
         <li>33333333</li>
         <li>44444444</li>
         <li>55555555</li>
         <li>66666666</li>
     </ul>
</div>
  <script type="text/javascript"> 
function startmarquee(lh,speed,delay,index){ 
var t; 
var p=false; 
var o=document.getElementById("marqueebox"+index); 
o.innerHTML+=o.innerHTML; 
o.onmouseover=function(){p=true} 
o.onmouseout=function(){p=false} 
o.scrollTop = 0; 

function start(){ 
t=setInterval(scrolling,speed); 
if(!p){ o.scrollTop += 1;} 


function scrolling(){ 
if(o.scrollTop%lh!=0){ 
o.scrollTop += 1; 
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0; 
}else{ 
clearInterval(t); 
setTimeout(start,delay); 


setTimeout(start,delay); 

startmarquee(50,30,3000,0); </script> 
</body> 
</html> 
 

解决方案 »

  1.   

    改好了:
    <!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=gb2312" /> 
      <title>文字向上滚动</title> 
      <style type="text/css"> 
       .box{width:500px; height:150px;line-height:25px; border:#bbb 1px solid; overflow:hidden;} 
       .box ul{margin:0; padding:0} 
       .box li{font-size:12px; } 
      </style> 
    </head> <body> 
        <div class="box" id="marqueebox0"> 
                <ul>
                    <li>11111111</li>
                    <li>22222222</li>
                    <li>33333333</li>
                    <li>44444444</li>
                    <li>55555555</li>
                    <li>66666666</li>
                </ul>
        </div>
     
    <input value = "1" id="tt">
    <input value = "1" id="tt2">
        <script type="text/javascript"> 
            function startmarquee(lh,speed,delay,index){ 
                var t; 
                var p=false; 
                var o=document.getElementById("marqueebox"+index); 
                o.innerHTML+=o.innerHTML; 
                o.onmouseover=function(){p=true} 
                o.onmouseout=function(){p=false} 
                o.scrollTop = o.scrollHeight;
                
                function start(){ 
                    t=setInterval(scrolling,speed); 
                    if(!p){ o.scrollTop -= 1;document.getElementById("tt").value = o.scrollTop;document.getElementById("tt2").value = document.getElementById("tt2").value * 1 + 1;} 
                } 
                
                function scrolling(){ 
                    if(o.scrollTop % lh != 0){
                    o.scrollTop -= 1; 
                    if(o.scrollTop <= 0){ 
                     o.scrollTop = o.scrollHeight; 
                    }
                    }else{ 
                        clearInterval(t); 
                        setTimeout(start,delay); 
                    } 
             } 
                 setTimeout(start,delay); 
            } 
    startmarquee(50,30,3000,0); </script> 
    </body> 
      

  2.   

     o.scrollTop += 1; ====>>  o.scrollTop -= 1;这种问题 朋友你要自己先调试下代码滑动,无怪乎就是控制了你的容器向左/向右/向上/向下,那么涉及到的css不就是left,top变换就可以了么