不同浏览器计算页面高度的不同方法

<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gbk">
<title>不同浏览器计算页面高度的不同方法</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css">
<style>
	body{font:12px/1.5 "宋体";}
	table{ border:1px solid #ccc; border-width:1px 0 0 1px; border-collapse:collapse;}
	th,td{ padding:4px 15px; border:1px solid #ccc; border-width:0 1px 1px 0;}
  th{ background-color:#eee;}
</style>
</head>
<body>
<table>
	<thead>
  	<tr>

    	<th></th>
    	<th>IEs</th>
      <th>Firefox</th>
      <th>opera</th>
      <th>Chrome、safari</th>
    </tr>
  </thead>

  <tbody>
  	<tr>
    	<th>documentElement</th>
      <td>1629(IE8:1628)</td>
      <td>1626</td>
      <td>1626</td>
      <td>98</td>

    </tr>
  	<tr>
    	<th>body</th>
      <td>82</td>
      <td>82</td>
      <td>82</td>
      <td>1636、1637</td>

    </tr>
  </tbody>
</table>
<div style="position:absolute; background-color:#ccc;"><button id="btn" class="open" style="padding:5px 15px;">废弃的按钮</button><div>我是一个绝对定位的层<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>test2<br>我是一个绝对定位的层<br></div></div>

<script>
(function(){
		alert("documentElement:" + document.documentElement.scrollHeight + ";body:" + document.body.scrollHeight);
})();
</script>
</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值