在我的页面里document.body.clientWidth属性不好用得到的值和document.body.scrollHeight一样。都是全部文档的高度
我的页面头是:
<!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">就是document.body.offsetHeight属性 都不好用,得到的也是全文的高度现在我想让图层右下角定位,并滚动跟随(在IE6下,IE6不支持fixed)我需要怎么做啊?????
我的页面头是:
<!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">就是document.body.offsetHeight属性 都不好用,得到的也是全文的高度现在我想让图层右下角定位,并滚动跟随(在IE6下,IE6不支持fixed)我需要怎么做啊?????
<!doctype html>
<html dir="ltr" lang="zh-CN">
<head>
<meta charset="utf-8"/>
<title>CSS Position Fixed for IE6</title>
<style>
* html,* html body {background-image:url(about:blank);background-attachment:fixed;}
* html .fixed-top {position:absolute;bottom:auto; top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 ));}
* html .fixed-right {position:absolute;right:0px;left:auto;}
* html .fixed-bottom {position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
* html .fixed-left {position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}
.fixed-bottom {
position:fixed;
left:0px;
bottom:20px;
background:aqua;
width:200px;
height:200px;
}
.fixed-right{
position:fixed;
right:0px;
left:auto;
top:200px;
top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 ));
background:red;
width:200px;
height:200px;
}
.fixed-top{
position:fixed;
top:0px;
left:0px;
background:blue;
width:200px;
height:200px;
}
</style> </head>
<body>
<div style='height:2000px;width:500px;margin:10px auto; border:1px solid red;'></div>
<div class="fixed-top"></div>
<div class="fixed-bottom"></div>
<div class="fixed-right"></div>
</body>
</html>