gpt4 book ai didi

internet-explorer - HTML/DOM : What is standards equivalent of document. body.scrollHeight?

转载 作者:太空狗 更新时间:2023-10-29 16:03:19 26 4
gpt4 key购买 nike

近十年来我一直在使用:

document.body.scrollHeight 

返回浏览器窗口的“理想”高度。当我使用 quirks-mode 文档类型强制 Internet Explorer 进入quirks 模式时,这工作正常:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

现在我想选择加入标准模式,除了the meaning of scrollHeight has changed :

  • 怪癖模式:document.body.scrollHeight =文档的高度
  • 标准模式:document.body.scrollHeight = <body> 的高度元素

document.body.scrollHeight 的标准模式是什么? ?

另见

最佳答案

document.documentElement.scrollHeight 我相信。

对于视口(viewport),对于现代浏览器,它是 window.innerHeight

如果以上不是你想要的,这里有一堆列表:

  • document.documentElement.[scrollHeight,clientHeight,offsetHeight]
  • document.body.[scrollHeight,clientHeight,offsetHeight]
  • window.[inner,outer][Height,Width](仅限现代浏览器)

关于internet-explorer - HTML/DOM : What is standards equivalent of document. body.scrollHeight?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3788830/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com