固底在右下脚支持ie6

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>固底在右下脚支持ie6</title>
<script type="text/javascript">
 
 window.onscroll= window.onresize = window.onload = function (){
  var getDiv = document.getElementById('rightBottom');
  var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  
  getDiv.style.left= document.documentElement.clientWidth - getDiv.offsetWidth+'px';
  getDiv.style.top = document.documentElement.clientHeight-getDiv.offsetHeight +scrollTop +'px';
  
  
 }  

</script>
</head>

<body style=" height:2000px; ">
 <div id="rightBottom" style=" width:100px; height:100px; background:blue; position:absolute; "></div>
</body>
</html>

posted on 2012-02-24 11:43  仙梦之飘  阅读(196)  评论(0编辑  收藏  举报