发现浏览器 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取颜色值竟然是一样的!!!
[解决办法]
难道会不一样?