鼠标控制DiV层滚动

<html>
        <body  onscroll="move()">
<div style="position:absolute;top:30px;left:0px; width:300; height:300" id=a>
  <table width="50" height="100%" bgcolor="blue">
          <tr width="100%" height="100%"><td width="100%" height="100%">ddddddd</td></tr>
  </table>
</div>
  <table width="1000%" height="1000" >
          <tr width="100%" height="100%"><td width="100%" height="100%">ddddddd</td></tr>
  </table>
        <script>
                  function move() {
                      var y = document.body.scrollTop;
                      document.getElementById("a").style.top = eval(y+30)+"px";
                      var x = document.body.scrollLeft;
                      document.getElementById("a").style.left = eval(x)+"px";
                  }
        </script>
</body>
</html>

鼠标滚动,层跟着滚动

你可能感兴趣的:(鼠标控制div层滚动)