【发布时间】:2019-09-10 14:44:07
【问题描述】:
我从这个问题 (How to get document height and width without using jquery) 中得到了这个代码:
width = Math.max(
document.documentElement.clientWidth,
document.body.scrollWidth,
document.documentElement.scrollWidth,
document.body.offsetWidth,
document.documentElement.offsetWidth
);
它有多可靠?它在 Opera 12 上似乎没有按预期工作 - 但现在已经相当老了。
除了那个浏览器,它似乎还可以。
【问题讨论】:
标签: javascript