我正在写该显示包含一些文本的StatusBarPanel Firefox扩展。我想改变取决于消息我的StatusBarPanel的背景色。例如红色背景中的错误。

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

所有上述代码的工作,除了最后一行,这会导致没有变化。的属性发生变化的实际价值,但仍的StatusBarPanel显示默认状态栏的颜色。我也试过background而不是backgroundColor但这并不能帮助。

有帮助吗?

解决方案

像以前的解决方案,但仅使用javascript:

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

请注意,你这样做后,你几乎必须再次从头风格它,它可能也失去了它的操作系统特定的风格。

其他提示

Try to set the -moz-appearance CSS property to 'none' or 'none !important'

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top