开发者

How to change opacity of a Xul element at runtime?

开发者 https://www.devze.com 2023-01-28 00:29 出处:网络
I\'ve tried document.getElementById(\"myId\").style = \"opacity: 0.5\"; but it didn\'t work: Error: setting a property that has

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消