您的位置:首页 > Web前端

the different of IE and Chrome when return the color style

2013-10-05 15:46 411 查看
<style>
div{
width:50px;
height:50px;
}
</style>
<script>
function showColor(obj){
alert(obj.style.backgroundColor);
}
</script>
<div id='a' style='background-color:red;' onclick='showColor(this)'></div>
<div id='b' style='background-color:#eeeeff' onclick='showColor(this)'></div>
<div id='c' style='background-color:rgb(1,11,111)' onclick='showColor(this)'></div>


sourceIEchrome
redredred
#eeeeff#eeeeffrgb(138, 138, 256)
rgb(1,11,111)rgb(1,11,111)rgb(1, 11, 111)
IE返回值与原来相同。

而Chrome返回值除预定义(red,blue等)的外,

均返回reb形式(notice:判断字符串相等时注意rgb显示中后2个数字的前有个个半角空格)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐