学习一个有用的方法
getBoundingClientRect
Method :
(introduced in firefox 3,Firefox 3.5 adds width
and height
properties to the TextRectangle
object.)
The returned value is a TextRectangle object, which contains read-only left, top, right and bottom properties describing the border-box, in pixels, with the top-left relative to the top-left of the viewport(not the document)