How to change statusbarpanel background color in firefox extension

I'm writing a firefox extension which displays a statusbarpanel containing some text. I want to change the background color of my statusbarpanel depending on the message. eg red background for errors.

var pnl = document.getElementById("panelId");
pnl.label = "OK";
pnl.style.color = "white";
pnl.style.backgroundColor = "green";

All of the above code works except for the last line, which causes no change. The actual value of the property changes, but the statusbarpanel still shows the default status bar color. I also tried background instead of backgroundColor but that doesn't help.


Like the previous solution but only using javascript :

var pnl = document.getElementById("panelId");
pnl.label = "OK";
pnl.style.color = "white";
pnl.style.backgroundColor = "green";
pnl.style.MozAppearance = "none"

Note that after you do this you'll pretty much have to style it from scratch again and it will probably also lose it's OS specific style.


尝试将-moz-appearance CSS属性设置为'none''none !important'

链接地址: http://www.djcxy.com/p/87664.html

上一篇: 在移动网络应用程序中单击更改按钮背景颜色

下一篇: 如何更改firefox扩展中的statusbarpanel背景颜色