本帖最后由 feeso4 于 2011-11-30 08:59:56 编辑

解决方案 »

  1.   


    可是这样div不随着滚动条移动跟着动啊
      

  2.   

    不太懂楼主是什么意思,你看是不是要这样
    <div style="position:absolute" id="Javascript.Div4">Javascript.Div4</div>
    <div style="position:absolute" id="pic_show">pic_show</div>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <p>其他内容</p>
    <script>
    function sc4(){
     
    divWidth = parseInt(document.getElementById("Javascript.Div4").offsetWidth,10) docWidth = document.body.clientWidth; document.getElementById("Javascript.Div4").style.top = parseInt(document.documentElement.scrollTop,10); 
    document.getElementById("Javascript.Div4").style.left = parseInt(document.documentElement.scrollLeft,10)+ docWidth - divWidth;
    document.getElementById("pic_show").style.top = parseInt((document.documentElement.scrollTop)+90,10); 
    document.getElementById("pic_show").style.left = parseInt(document.documentElement.scrollLeft,10)+ docWidth - divWidth;}sc4();
    window.onscroll=sc4;
    window.onresize=sc4;
    window.onload=sc4;</script>
      

  3.   

    我只做了一个跟着页面滚动的,估计你的问题是DIV定位的问题,当DIV的position属性是absolute的时候,你才可以操作它的什么left啊,top这些属性。也不知道你的问题是不是这样,代码给你看看,你改一下;
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <style type="text/css">
    #d0{
    width:10;
    height:1000;
    background:#E3E3E3;
    display:inline;
    }
    #d1{
    width:100;
    height:100;
    background:#E3E3E3;
    position:absolute;
    }
      </style>
      <script type="text/javascript">
    window.onscroll=scall;
    window.onresize=scall;
    window.onload=scall;
    function scall(){
    document.getElementById("d1").style.top   = document.body.scrollTop; 
    document.getElementById("d1").style.right = 0 - document.body.scrollLeft;
    }

      </script>
     </HEAD>
     <BODY>
    <div id="d1"></div>
    <!--撑起页面滚动条-->
    <div id="d0"></div>  
     </BODY>
    </HTML>