在一个网页里,我做了个DIV控件,我想要实现的效果是如何让这个DIV控件随网页的滚动条而移动,就是我拉下滚动条时,这个DIV控件也一起移下来,就是不管我怎么拉,我的屏幕上始终能看到这个DIV控件

解决方案 »

  1.   

    css里面有个定位的属性叫position:fixed
    fixed 位置被设置为 fixed 的元素,可定位于相对于浏览器窗口的指定坐标。此元素的位置可通过 "left"、"top"、"right" 以及"bottom" 属性来规定。不论窗口滚动与否,元素都会留在那个位置。工作于 IE7(strict 模式)。 
      

  2.   

    http://ad.jz123.cn/ad/01/
    其实你要的效果这里有
    JS去下载他的JS看吧
      

  3.   

    <html>
    <head>
    <title>wujinjian</title>
    </head>
    <script language="javascript">
    function move()
    {
    var y=200;
    var y=document.body.scrollTop+y; eval("document.all.imageLayer2.style.posTop=y");

    setTimeout("move();",1);
    }
    </script>
    <body onLoad="move()">
    <div id=imageLayer2 style="position:absolute;visibility:visible;left:500px;top:200px;width:100px;height:100px;background-color:red;">

    </div>
    8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>
    8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>
    </body>
    </html>将代码复制下来,保存为*.html,双击打开看看是不是你要的那种效果。
      

  4.   

    这东西你用google能找出一堆来
      

  5.   

    setInterval(function(){
    document.getElementById("div1").style.top=document.body.clientHeight+"px";
    },200);