How to change opacity of a Xul element at runtime?
I've tried
document.getElementById("myId").style = "opacity: 0.5";
but it didn't work:
Error: setting a property that has only a getter
Also looks like t开发者_JS百科here's no "opacity" attribute or parameter (in the box
or window
element).
Any idea?
Try setting the style as an attribute
document.getElementById("myId").setAttribute("style", "opacity: 0.5");
The opacity is a property of the style property i.e.
document.getElementById("myId").style.opacity = 0.5;
精彩评论