1.通过dom的style属性获取宽和高,只能获取内联属性的值
dom.style.width/height
2.无论像是class还是内联还是style都会被浏览器渲染,在渲染之后就会通过currentStyle,不过只有IE支持
dom.currentStyle.width/height
3.getComputedStyle兼容Firefox和Chrome
window.getComputedStyle(dom).width/height
4.getBoundingClientRect,主要是基于绝对位置的计算(能够拿到top、left、width、height)
dom.getBoundingClientRect().width/height