首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

分享: 无奈了,自己动手做字幕滚动解决方法

2012-02-24 
分享: 无奈了,自己动手做字幕滚动自己动手,丰衣足食!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.1//EN http:

分享: 无奈了,自己动手做字幕滚动
自己动手,丰衣足食

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.1//EN "   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd ">

加了这段之后,以前能滚的DIV,不让滚了,但是老板还要要滚呀!!!
妈的什么标准,尽在折磨人.

分析了下原因,加了这个之后.div.scroolTop始终为   0   ..........没办法了
一个一个试,把div的   style= "overflow:hidden; "改成style= "overflow:auto; "后,scroolTop有值,但是....滚动条出来了,fuck   !!!
单独做了一个遮羞布,把滚动条遮住了,

另求:offsetLeft,offsetWidth   好像会偏一点,不知何故?望达人赐教

完全代码如下:


<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.1//EN "   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd ">
<html>    
<head>    
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">    
<title> 滚动 </title>    
<style> a{text-decoration:none;color:3366cc} </style>    
</head>    
<body>    


<div   id=oDiv   style= "width:150px;border:1   solid   red;overflow:auto;height:200px;float:left;   "   onmouseover= "clearInterval(s) "   onmouseout= "s=setInterval(fsnMarquee,30) ">    
<span   id=oSpn>    
        <a   href= '# '> 1111111 </a> <br>    
        <a   href= '# '> 2222222 </a> <br>    
        <a   href= '# '> 3333333 </a> <br>    
        <a   href= '# '> 4444444 </a> <br>    
        <a   href= '# '> 5555555 </a> <br>    
        <a   href= '# '> 6666666 </a> <br>    
        <a   href= '# '> 7777777 </a> <br>    
        <a   href= '# '> 8888888 </a> <br>    
        <a   href= '# '> 9999999 </a> <br>    
</span>    
</div>

<div   id= "divMark "   style= "display:none; ">  
    &nbsp;
</div>
  <div   id= "markScroll "   style= "width:15px;float:right;height:100%; "> <iframe   src= "about:blank "   width= "100% "   height= "100% "   scrolling= "no "   frameborder= "0 "> </iframe>   </div>
<script   language= "javascript "   type= "text/javascript ">    
var   i=0     ;
var   s=null     ;
function   fsnMarquee()
{      
      if(oDiv.scrollTop> =oSpn.offsetHeight-oDiv.offsetHeight-50){      
                oSpn.innerHTML+=oSpn.children[i].outerHTML       ;
                i++       ;
        }      
      else   oDiv.scrollTop   ++   ;
}      



window.onload   =   function(){s=setInterval(fsnMarquee,100);markScrollBar();}      

function   markScrollBar()
{
        divMark.style.position= "absolute ";
        divMark.style.left   =   oDiv.offsetLeft+oDiv.offsetWidth-8;
        divMark.style.top   =   oDiv.offsetTop;
        divMark.style.width   =   "20 ";
        divMark.style.height   =   oDiv.offsetHeight+16;
        divMark.style.backgroundColor   =   "#ffffff ";
        divMark.style.visibility   =   "visible ";
        divMark.style.zIndex   =   "100 ";
        divMark.style.display   =   " ";
}
</script>    
   
</body>    
   
</html>    




[解决办法]
接分
[解决办法]
hidden也滚动啊.ie6
[解决办法]
jf

热点排行