日期:2014-05-16  浏览次数:20430 次

pixelHeight与offsetHeight的问题
为什么我对一个Div的
style.pixelHeight = 18
结果,我机器的IE中显示的offsetHeight是24pixel的(style.pixelHeight确为18),而我同事的IE中显示的却又是18pixel的(style.pixelHeight确为18)?
同样设置Height,怎么会不一样高的呢?


------解决方案--------------------
可能浏览器设置的字体大小不一样
比如
<html>
<head>
<title>newpage</title>
<script defer>
alert(div1.style.pixelHeight);
alert(div1.offsetHeight);
</script>
</head>
<body>
<div name=div1 id=div1 style="height:18px">
<font size=10>12321412412421412</font>
</div>
</body>
</html>