function move(){
if(Initialization)
    { if(i!=40)//这个数值要根据高度来定

解决方案 »

  1.   

    不懂楼上的意思噢
    if(i!=40) 那不是把所有的div都移到浏览器下面去拉?
    34是算出来的 移动速度是5   下面div的高度是170    170/5=34          
    水平还不够,所以还没打算写成控件的样式  
      

  2.   

    我这里测试设为40后,内容部分(content)正好下移到不见,只露出蓝色的头部(title)。
    那么你要的是什么效果?
      

  3.   

    那就奇怪了   我这边是34刚好看不见content
    问题在: 当content移到浏览器的下面的时候 往下拉滚动条 ,一直拉不到底部.
    请指教了!~
      

  4.   

    我是IE6 ,有这个问题
    这个还是有问题,我用ie6看别人的网站上的这个框框,隐藏content后 可以拉到底部.
      

  5.   

    手边没有IE6,不能帮你测试.不过我在FF下看了,兼容问题还挺多的.
      

  6.   

    function move(){
    if(Initialization)
        { if(i!=40)//这个数值要根据高度来定
      

  7.   

    FF 相对严格一些,必须加上单位
    改了一下,IE6 和 FF 下没问题,没试 IE7修改的地方已经用注释标明<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loosevent.dtd">
    <html>
    <head>
    <title>测试</title>
    <style type="text/css"> 
    <!-- 
    #xx{ position:absolute; width:200px;;border:1px solid #999999;}
    #title{font-size:12px;height:30px;width:100%;background:#0099FF;} 
    #content{font-size:12px;height:170px;width:100%;}
    --> 
    </style> 
    <script> 
    var Initialization =true     //判断div是否滚动下去了 true没下去  false下去了
    var Opacity =100             //设置透明度
    var i=0
    window.onresize = resizeDiv;
    window.onscroll = resizeDiv;
    function resizeDiv()
    {
    divHeight = parseInt(document.getElementById("xx").offsetHeight,10);
    divWidth = parseInt(document.getElementById("xx").offsetWidth,10);
    docWidth = document.documentElement.clientWidth;
    docHeight = document.documentElement.clientHeight;
    if(Initialization)
    {document.getElementById("xx").style.top = docHeight + parseInt(document.documentElement.scrollTop,10) - divHeight + "px";// 增加 px
    document.getElementById("xx").style.left = docWidth + parseInt(document.documentElement.scrollLeft,10) - divWidth + "px";}// 增加 px
    else
    {
    document.getElementById("xx").style.top = docHeight + parseInt(document.documentElement.scrollTop,10) - divHeight + 170 + "px";// 增加 px
    }
    }function move(){
    if(Initialization)
        { if(i!=34)
         {
           i++;
           document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top.replace("px","")) + 5 + "px";// 增加 replace ,增加 px
           tt=setTimeout("move()",10)
         }
        else
       {window.clearTimeout(tt); Initialization=false;}
    }
    else
    {
      if(i!=0)
       {
         i--
         document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top.replace("px","")) - 5 + "px";// 增加 replace ,增加 px
         tt=setTimeout("move()",10)
       }
       else
       {Initialization=true;window.clearTimeout(tt)}
    }
    }function disappear(){
    if(Opacity==0)
    {window.clearTimeout(time);
    document.getElementById('xx').style.display="none";}
    else
    {
    Opacity=Opacity-10;
    document.getElementById('xx').style.filter = "Alpha(opacity="+Opacity+")";
    time=setTimeout("disappear()",50)
    }
    }
    </script> <body onload="resizeDiv()"> 
    hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>
    <div id="xx">
    <div id="title">
    <span style="top:7px;left:10px; position:relative;">新闻列表</span>
    <span style="top:7px;left:105px; position:relative; cursor:hand;" onClick="move()">--</span>
    <span style="top:7px;left:110px; position:relative; cursor:hand;" onClick="disappear()">X</span>
    </div>
    <div id="content"></div> 
    </div> 
    </body> 
    </html>
      

  8.   


    试过了,IE7也没问题.
    FF下两个cursor:hand 也要改一下:cursor:pointer
      

  9.   

    10楼的朋友 好象+"px"只是兼容ff
    但是问题并没有解决    
    问题出来的过程是这样的:
    隐藏了content部分后 (就是按了"--"这个后,title并没有隐藏,就是那个兰色的标题栏还在)
    拖动框框       那个框框(蓝色的标题拦)无法到达底部,一直无限延伸.
    恩 就是这样   
      

  10.   

    晕,忘了改了一下,应该可以了(IE6 和 FF 正常)
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loosevent.dtd">
    <html>
    <head>
    <title>测试</title>
    <style type="text/css"> 
    <!-- 
    #xx{ position:absolute; width:200px;;border:1px solid #999999;}
    #title{font-size:12px;height:30px;width:100%;background:#0099FF;} 
    #content{font-size:12px;height:170px;width:100%;}
    --> 
    </style> 
    <script> 
    var Initialization = true;     //判断div是否滚动下去了 true没下去  false下去了
    var Opacity = 100;             //设置透明度
    var i = 0;
    window.onresize = resizeDiv;
    window.onscroll = resizeDiv;
    function resizeDiv(){
    divHeight = parseInt(document.getElementById("xx").offsetHeight,10);
    divWidth = parseInt(document.getElementById("xx").offsetWidth,10);
    docWidth = document.documentElement.clientWidth;
    docHeight = document.documentElement.clientHeight;
    if(Initialization){
    document.getElementById("xx").style.top = docHeight + parseInt(document.documentElement.scrollTop,10) - divHeight + "px";// 增加 px
    document.getElementById("xx").style.left = docWidth + parseInt(document.documentElement.scrollLeft,10) - divWidth + "px";// 增加 px
    }else
    {
    document.getElementById("xx").style.top = docHeight + parseInt(document.documentElement.scrollTop,10) - divHeight + "px";// 增加 px,第二次修改去掉了 170
    }
    }function move(){
    if(Initialization)
    {
    document.getElementById("content").style.display = "none";// 第二次修改
    if(i!=34)
         {
           i++;
           document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top.replace("px","")) + 5 + "px";// 增加 replace ,增加 px
           tt=setTimeout("move()",10)
         }
        else
       {window.clearTimeout(tt); Initialization=false;}
    }
    else
    {
    document.getElementById("content").style.display = "block";// 第二次修改
      if(i!=0)
       {
         i--
         document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top.replace("px","")) - 5 + "px";// 增加 replace ,增加 px
         tt=setTimeout("move()",10)
       }
       else
       {Initialization=true;window.clearTimeout(tt)}
    }
    }function disappear(){
    if(Opacity==0)
    {window.clearTimeout(time);
    document.getElementById('xx').style.display="none";}
    else
    {
    Opacity=Opacity-10;
    document.getElementById('xx').style.filter = "Alpha(opacity="+Opacity+")";
    time=setTimeout("disappear()",50)
    }
    }
    </script> <body onload="resizeDiv()"> 
    hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>
    <div id="xx">
    <div id="title">
    <span style="top:7px;left:10px; position:relative;">新闻列表</span>
    <span style="top:7px;left:105px; position:relative; cursor:hand;" onClick="move()">--</span>
    <span style="top:7px;left:110px; position:relative; cursor:hand;" onClick="disappear()">X</span>
    </div>
    <div id="content">aaaaaaaaaaa</div> 
    </div> 
    </body> 
    </html>
      

  11.   

    嘿嘿
    明白你的意思了
    你是一开始就隐藏下面的content
    所以在
    document.getElementById("xx").style.top = docHeight + parseInt(document.documentElement.scrollTop,10) - divHeight + "px";
    中的divWidth已经减去了170, 
    估计浏览器是按照包括所有元素来显示大小的,所以我那样才会无限延. - -!
    这个我自己在修改成需要的样子
    非常感谢!