Java script 的offsetWidth,offsetHeight,offsetLeft,offsetRight的意思,用途是撒子

2025-12-05 16:00:05
推荐回答(1个)
回答1:

元素的宽度,高度,离左边的距离,离右边的距离。
比如:我想知道body的宽度,高度,离左边的距离,离右边的距离.
通过
document.body.offsetWidth,
document.body.offsetHeight,
document.body.offsetLeft,
document.body.offsetRight
便可以计算出来、