js获取元素宽高

dom.style.width/height
只能内联样式

1.内联 2.外部引入 3.style标签

dom.currentStyle.withd/height(只能ie)

window.ComputedStyle(dom).width/height(都行!!!)

计算元素绝对位置
dom.getBoundingClientRect().width/height 可以拿到 left right

猜你喜欢

转载自blog.csdn.net/weixin_42310711/article/details/88854069
今日推荐