文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>javascript 获取html元素的绝对位置...

javascript 获取html元素的绝对位置...

时间:2010-08-14  来源:baoeni

有时候我们需要知道HTML元素的觉得位置,用ele.offsetTop和ele.offsetLeft只能得到相对位置,这时可以用oElm.getBoundingClientRect
 


 http://msdn.microsoft.com/en-us/library/ms536433%28VS.85%29.aspx
 https://developer.mozilla.org/en/DOM/element.getBoundingClientRect
 http://www.quirksmode.org/dom/w3c_cssom.html 

 Returns a TextRectangle object. Each rectangle has four integer properties (top, left, right, and bottom)
 that represent a coordinate of the rectangle, in pixels.
 
 the browser calculates all rectangles (see below getClientRects()), and getBoundingClientRect() returns the lowest (top, left) or highest (bottom, right) values found.

相关阅读 更多 +
排行榜 更多 +
宝宝巴士宝宝家园清洁

宝宝巴士宝宝家园清洁

休闲益智 下载
两个家伙和僵尸2内置作弊菜单

两个家伙和僵尸2内置作弊菜单

飞行射击 下载
宝宝巴士小魔女传奇

宝宝巴士小魔女传奇

休闲益智 下载