js 控制 style 中 bottom (style.pixelBottom)

<!DOCTYPE html>
<html>
<head>
 <script type='text/javascript'> 
  onload=function(){
   var getDiv = document.getElementById("div1");   
   getDiv.onmouseover = function(){    
    this.style.pixelBottom==0?this.style.pixelBottom=280:this.style.pixelBottom=0;
   }
  }


 </script>
 <style type="text/css">
  div{border:solid 1px Red;}
  #div0{width:200px; margin:auto; height:300px;position:relative}
  .div1{position:absolute;bottom:100px;width:198px; background:Red;}
 </style>
</head>
 <body>
  <div id="div0">
   <div id="div1" class="div1">
    aaaaaaaaaaaaaaa
   </div>  
  </div>
 </body>
</html>

posted @ 2011-07-02 09:08  sirzxj  阅读(882)  评论(0编辑  收藏  举报