【发布时间】:2009-09-11 07:55:11
【问题描述】:
我需要在两种颜色之间闪烁:红色和白色。
我发现$targetcss('background-color','red')之后,
$targetcss('background-color')的值不是红色,而是rgb(255, 255, 255),
注意firefox中“,”和数字之间有空格,
但是 IE 中没有空格。
我的代码现在是:
if(existingBgColor != 'rgb(255, 255, 255)')
$target.css('background-color', 'rgb(255, 255, 255)');
else
$target.css('background-color', 'white');
在 Firefox 中有效,但在 IE 中无效。
当然我可以改成这个来申请IE:
if(existingBgColor != 'rgb(255, 255, 255)' && existingBgColor != 'rgb(255,255,255)')
$target.css('background-color', 'rgb(255, 255, 255)');
else
$target.css('background-color', 'white');
但是对于第三个浏览器呢?
这有标准的解决方案吗?
【问题讨论】: