View Full Version : Having trouble with styles and mozilla

08-16-2004, 08:54 PM
How do I use a style to change the opacity of an image with the document.getElementById method? All help is appreciated.

Mr J
08-16-2004, 09:38 PM
For Mozilla it is something like


08-16-2004, 10:40 PM
I currently have this for mozilla

document.getElementById("image3").style="-moz-opacity: 70%";


document.images["image3"].style="filter: alpha(opacity=50)";

for internet explorer. These keep throwing errors. I thought the IE way worked until I checked it again. Has anyone done anything like this? all help is appreciated.

08-16-2004, 11:07 PM
Wrong syntax. As Mr. J illustrated, you have to reference the style property in the dot syntax. Not like you do in CSS.

document.getElementById("problem").style.display = "block"; is valid

document.getElementById("problem").style = display: block; is not

08-19-2004, 09:53 PM
How could I have missed that, thanks fellas.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum