亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我測試出來的document.documentElement.offsetWidth;不包含滾動條寬度

為什么我測試出來的document.documentElement.offsetWidth;不包含滾動條寬度

慕姐8259394 2017-08-06 20:08:56
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">body{border:3px red solid;? ? padding:0;? ? margin:0;}</style></head><body><p>yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><p>yyy</p><script type="text/javascript">var h=document.documentElement.offsetHeight;var w=document.documentElement.offsetWidth;document.write(h+"<br>");document.write(w+"<br>");document.write("<br>");var h2=document.documentElement.scrollHeight;var w2=document.documentElement.scrollWidth;document.write(h2+"<br>");document.write(w2+"<br>");document.write("<br>");var h1=window.innerHeight;var W1=window.innerWidth;var h1_1=document.documentElement.clientHeight;var W1_1=document.documentElement.clientWidth;var h1_2=document.body.clientHeight;var W1_2=document.body.clientWidth;document.write(h1+"&nbsp"+h1_1+"&nbsp"+h1_2+"<br>");document.write(W1+"&nbsp"+W1_1+"&nbsp"+W1_2+"<br>");document.write("<br>");</script></body></html>這是得到的結果1246130813002147605?588?13481325?1308?1302為什么我測試出來的document.documentElement.offsetWidth;的寬度減去了滾動條寬度17px,不是說包含滾動條寬度嗎?如果刪去了上面內容是三個Y的所有p元素,這時document.documentElement.scrollHeight小于document.documentElement.clientHeight,但卻沒有返回一個值等于它document.documentElement.clientHeight。
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1786 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號