adminysh

[经典代码] DIV层的应用技巧汇总[跟随鼠标显示隐藏等]

DIV层的应用技巧汇总[跟随鼠标显示隐藏等]

跟随鼠标移动最简单的代码

 
<div   id=pop   style="position:absolute;width:100;height:50;z-index:99">   
  <table   border=0   bgcolor=#FF0000><tr><td   align=center>层里文字</td></tr></table></div>   
    
  <script   language=javascript>   
  function   document.onmousemove()   
  {   
      var   a   =   document.body.scrollTop;   
      var   b   =   document.body.scrollLeft;   
      var   x   =   window.event.x;   
      var   y   =   window.event.y;   
      document.all.pop.style.top   =   a   +   y;   
      document.all.pop.style.left=   b   +   x;   
  }   
  </script>


#1楼
发帖时间:2013-2-22   |   查看数:0   |   回复数:0
游客组