首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

发现浏览器 getComputedStyle 一个bug。解决方案

2012-04-09 
发现浏览器 getComputedStyle 一个bug。检查网页:HTML codehtmlheadscript type text/javascript

发现浏览器 getComputedStyle 一个bug。
检查网页:

HTML code
<html><head><script type = 'text/javascript'>  function OnCheck(){  var ele = document.getElementById('id')  var col= getComputedStyle(ele, "").color; //获得超链接字体颜色.  alert(col);}</script></head><body> <a id='id' href="http://www.baidu.com/">百度</a> <input type= "button" value="检查是否访问过链接" onclick='OnCheck()' /> </body></html>


环境为 chrome和firefox最新版本。

访问过超连接颜色会变化,可用getComputedStyle取颜色值竟然是一样的!!!

[解决办法]
难道会不一样?

热点排行