第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么兩種方法同一瀏覽器同一運(yùn)行環(huán)境,結(jié)果不一樣

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">?

</head>

<body>

<script type="text/javascript">

document.write("方法一:"+"<br>"+"實(shí)際高度:"+document.body.scrollHeight+" "+"實(shí)際寬度:"+document.body.scrollWidth+"<br>");

?document.write("方法二:"+"<br>"+"實(shí)際高度:"+document.documentElement.scrollHeight+" "+"實(shí)際寬度:"+document.documentElement.scrollWidth);

</script>

</body> ? ?

</html>


正在回答

1 回答

document.body和document.documentElement比較:

???? document.body是DOM中Document對(duì)象里的body節(jié)點(diǎn), document.documentElement是文檔對(duì)象根節(jié)點(diǎn)(html)的引用。
???? IE在怪異模型(quick mode)下document.documentElement無法正確取到clietHeight scrollHeight等值,比如clietHeight=0??梢砸奍E的怪異模型并沒有把html作為盒子模型的一部分,好在現(xiàn)在很少使用怪異模型。(注:如果頁面沒寫DTD或?qū)懙牟粚?duì),IE6默認(rèn)使用怪異模型解析頁面)

document.body.scrollHeight和document.documentElement.scrollHeight的區(qū)別:

???? document.body.scrollHeight是body元素的滾動(dòng)高度,document.documentElement.scrollHeight為頁面的滾動(dòng)高度,且 document.documentElement.scrollHeight在IE和Firefox下還有點(diǎn)小差異。
?????IE?: document.documentElement.scrollHeight = document.body.scrollHeight + marginTop bottom高度 + 上下border寬度
?????firefox?: document.documentElement.scrollHeight = document.body.scrollHeight + marginTop bottom高度


3 回復(fù) 有任何疑惑可以回復(fù)我~
#1

漩渦鳴人007 提問者

非常感謝!
2016-03-15 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么兩種方法同一瀏覽器同一運(yùn)行環(huán)境,結(jié)果不一樣

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)