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

推荐订阅源

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

博客园 - 清炒白菜

Unable to resume activity : android.database.StaleDataException: Attempted to access a cursor after it has been closed. 异常 Android的匿名Handler类引起的内存泄露 计算2个经纬度之间的距离 用bcp导入DateTime类型的数据 Linux下提示“omitting directory”错误的解决办法 Android的"返回“功能 EditText获得焦点后,如何关闭软键盘 获取当前Activity的Root View 用代码动态设置ImageView的align布局 Android中Sqlite数据库多线程并发问题 [转]Java的数组(Array)、Vector、ArrayList、HashMap的异同 用bcp导入大量数据(代替INSERT) ajax跨域访问问题 又一款分布式版本控制工具Mercurial bcp导入导出数据发生异常解决方案 - 清炒白菜 - 博客园 导出Google Reader中加星的内容项 - 清炒白菜 - 博客园 在win下使用GIT dotNet 自带线程池与HTTP访问的若干疑问 解决"the database principal owns a schema in the database and cannot be dropped"问题
HTML中element.style取值问题
清炒白菜 · 2010-12-02 · via 博客园 - 清炒白菜

2010-12-02 17:16  清炒白菜  阅读(1158)  评论()    收藏  举报

如果是把style写在HTML中, 就是inlineStyle, 可以用element.style来取值, 但是写在CSS中的属性, 无法通过element.style直接获取

比如div.style.display, 如果在CSS中设定的display:none, 就无法通过div.style.display来获取,只能用如下方法(未经过长期测试,暂时看来有效)

取css属性值

function getMyStyle(elementId,styleName)
{
    
var el = document.getElementById(elementId);
    
if (el.currentStyle)
        
var y = el.currentStyle[styleName];
    
else if (window.getComputedStyle)
        
var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleName);
    
return y;
}

参考:http://www.javaeye.com/topic/140784