To perform operations on the numeric value of this property, use pixelWidth or posWidth.width的值是字符串,pixelWidth值是整型,计算时应使用pixelWidth。
解决方案 »
- 关于一个遍历设置CSS样式的问题?
- 关于多级iframe的 DOM问题 修改父文档属性
- 简单问题 ,立刻给分(外行)
- 页面缩小以后,內容換行了...
- 为何此处要用单引号,不用双引号?请高人指点!多谢!
- 一个十分奇怪的现象,学会做网页四年来没碰到过的问题,与<input type="file" />有关!
- javascript 不用控件如何控制页面打印的样式(左右边距等)!
- frameset的菜单问题??在线等!
- 高分求教简单问题(解决问题分不够再加)
- 我的收藏!(一些常用的函数)
- 如何在activeX(vc)中调用页面上的javascript函数?
- realone控件 access数据库相关问题 TegoSoft公司出的将应用程序 嵌入网页运行的的控件问题
这样写就对了。
var strInfo="";
strInfo+="\r\n网页可见区域宽:"+document.body.clientWidth;
strInfo+="\r\n网页可见区域高:"+document.body.clientHeight;
strInfo+="\r\n网页可见区域宽:"+document.body.offsetWidth+"(包括边线的宽)";
strInfo+="\r\n网页可见区域高:"+document.body.offsetHeight+"(包括边线的宽)";
strInfo+="\r\n网页正文全文宽:"+document.body.scrollWidth;
strInfo+="\r\n网页正文全文高:"+document.body.scrollHeight;
strInfo+="\r\n网页被卷去的高:"+document.body.scrollTop;
strInfo+="\r\n网页被卷去的左:"+document.body.scrollLeft;
strInfo+="\r\n网页正文部分上:"+window.screenTop;
strInfo+="\r\n网页正文部分左:"+window.screenLeft;
strInfo+="\r\n屏幕分辨率的高:"+window.screen.height;
strInfo+="\r\n屏幕分辨率的宽:"+window.screen.width;
strInfo+="\r\n屏幕可用工作区高度:"+window.screen.availHeight;
strInfo+="\r\n屏幕可用工作区宽度:"+window.screen.availWidth;
window.confirm(strInfo);
</script>
#D0{
POSITION: absolute;
width: 300px;
}
</style>
....................
<script>
function Init()
{
d0 = document.getElementById('D0');
alert(d0.style.pixelWidth);
}//
</script>
</head>
<body>
...............