惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Last Watchdog
The Last Watchdog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 热门话题
G
GRAHAM CLULEY
S
Schneier on Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Recorded Future
Recorded Future
I
Intezer
云风的 BLOG
云风的 BLOG
博客园 - Franky
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
Attack and Defense Labs
Attack and Defense Labs
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
有赞技术团队
有赞技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
News and Events Feed by Topic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
The Cloudflare Blog
Webroot Blog
Webroot Blog
W
WeLiveSecurity
H
Heimdal Security Blog
博客园 - 三生石上(FineUI控件)
V
Vulnerabilities – Threatpost
G
Google Developers Blog
O
OpenAI News
V
V2EX
罗磊的独立博客
博客园_首页
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
TaoSecurity Blog
TaoSecurity Blog
Cloudbric
Cloudbric
H
Hacker News: Front Page
博客园 - 叶小钗
T
Tor Project blog
AI
AI

博客园 - 田了你

[ZF]开心一下 [转]Java jdbc数据库连接池总结! 一台机器部署N个server步骤 [转]软件开发者面试百问 09年的第一篇日志比已往的时候来得更早一些 - 田了你 - 博客园 [转]关于锚点 - 田了你 - 博客园 从今天开始每天写一篇日志咯 Telerik RadGrid 翻页问题解决 - 田了你 果然是本命年 javascript注册事件的四种方式 - 田了你 - 博客园 Tomcat5.x的项目部署 又被老板欺骗了 .net的优点变缺点(郁闷了一天) 2007.2.1 -----2007.4.1安排计划 关于NTKO_office的操作(从数据库中提取数据,写入到NTKO_office_Word中) [转]JS代码格式化工具(附源代码) 层的拖动 解决SQL2000乱码问题 ref与out
获得控件在页面上的绝对位置的方法
田了你 · 2007-01-11 · via 博客园 - 田了你

obj为控件对象。
function getAbsolutePos(obj)
{
    var pos = { x: 0, y: 0 };
    var offset_x = obj.clientLeft + 2;
    var offset_y = obj.clientTop + 2;
    function innerFunction()
    {
            while(obj)
            {
                pos.x += obj.offsetLeft;
                pos.y += obj.offsetTop;
                pos.x += obj.clientLeft;
                       pos.y += obj.clientTop;
                       /*如果需要计算滚动条
                       if(obj.scrollLeft)
                        pos.x += obj.clientLeft;
                       if(obj.scrollTop)
                               pos.y += obj.scrollTop;
                       */
                      
                obj=obj.offsetParent;
            }
        }
        innerFunction();
        pos.x -= offset_x;
        pos.y -= offset_y;
    return pos;
}