<script?type="text/javascript">
????var?wid=document.documentElement.scrollWidth||document.body.scrollWidth;
????var?hei=document.documentElement.scrollHeight||document.body.scrollHeight;
????alert('width='+wid+'?height='+hei);
</script>如上圖,此時(shí)文檔內(nèi)容為空, 獲取到的scrollHeight為8px但是當(dāng)把body的margin設(shè)置為0px 時(shí)body{margin:0px;},獲取到的crollHeight就和clientHeight相同,這是為什么謝謝大神們解答
在chrome中用scrollHeight獲取網(wǎng)頁高度時(shí)的疑問
那一年美然
2016-04-20 15:53:41