先上代码吧<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
</style>
<script type="text/javascript">
window.onload = function() {
document.body.style.backgroundColor = "#000";
var bodyHeight = document.body.offsetHeight;
alert(bodyHeight);
}
</script>
</head>
<body> </body>
</html>大侠看看,明明body的高度为0,为什么给body加背景颜色却显示为整个屏幕啊
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
</style>
<script type="text/javascript">
window.onload = function() {
document.body.style.backgroundColor = "#000";
var bodyHeight = document.body.offsetHeight;
alert(bodyHeight);
}
</script>
</head>
<body> </body>
</html>大侠看看,明明body的高度为0,为什么给body加背景颜色却显示为整个屏幕啊
其它浏览器有不同的处理.