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

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - .net小鸟

产品很重要 JQUERY FAQ 无法打开到主机的连接,在端口xxx连接失败 eclipse的调试技术 js parseInt与排序 html到asp.net样式变乱 django学习资料 FAQ python31操作MySql jquery iframe 父子互操作 .net连接mysql maven下载地址 jquery操作ul notepad++中用正则表达式 jquery 两个控件同享一个function javascript 经常会用到的东西 javascript template javascript closure anonymous function javafirststep
js工具类
.net小鸟 · 2011-09-01 · via 博客园 - .net小鸟

var tools = {    
    fixE:function(e)
    {
        return e||window.event;
    },
    getOffset:function(obj,isleft)
    {
        var ab=0;
        while(obj!=null)
        {
            ab+=obj["offset"+(isleft?"Left":"Top")];
            obj=obj.offsetParent;
        };
        return ab;
    },
    getDistance:function(left,top,left2,top2)
    {
        return Math.sqrt(Math.pow(left-left2,2)+Math.pow(top-top2,2))
    },
    preventDefault:function(e)
    {
        e=this.fixE(e);
        if(e.preventDefaults)
            e.preventDefaults();
        else
            e.returnValue=false;
    },
    cancelBubble:function(e)
    {
      e=this.fixE(e);
      if(e.stopPropagation)
      {
            e.stopPropagation();
      }
      else
      {
            e.cancelBubble=true;
      }
    },
    disableSelection:function(target){
        if (typeof target.onselectstart!="undefined") //IE route
            target.onselectstart=function(){return false}
        else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
            target.style.MozUserSelect="none"
        else //All other route (ie: Opera)
            target.onmousedown=function(){return false}
        target.style.cursor = "default"
    }
}