I know that this forum is for PHP, but maybe someone knows how to make in java script the code for an image opacity. I want that because if I put the opacity with css
#image
{
opacity: 0.30;
}
doesn't work in IE and Firefox, and I know that you can do that with java script, but I don't know how.
opacity
Moderator: General Moderators
Re: opacity
There's a lot of CSS 3 things that browsers can't do. I imagine opacity is one of them.
Re: opacity
Opacity is Actually CSS2.
http://www.quirksmode.org/css/opacity.html
http://www.mandarindesign.com/opacity.html
http://www.quirksmode.org/css/opacity.html
http://www.mandarindesign.com/opacity.html
Code: Select all
<div id="test"></div>
<style type="text/css">
#test{
background-color:red;
width:100px;
height:100px;
opacity:.30;
}
</style>Re: opacity
That's why we have a Client-Side forum. I'm moving the thread there.sorin21us wrote:I know that this forum is for PHP
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: opacity
Mod | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Thank you for the answers.
I was looking for something like this:
/*--- The code in js for opacity to works with filter IE and with opacity Firefox----*/
/*--The oapacity with CSS2 works only for Firefox---*/
Mod | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Thank you for the answers.
I was looking for something like this:
/*--- The code in js for opacity to works with filter IE and with opacity Firefox----*/
Code: Select all
function setOpacity(value) {
document.getElementById("mage").style.opacity = value/10;
document.getElementById("image").style.filter = 'alpha(opacity=' + value*10 + ')';
}Code: Select all
image
{
opacity: 0.30;
}Mod | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Re: opacity
IE doesn't support standards-based opacity (or at least IE6 didn't). You'll need to play around with the filter property. Google likely has something to say about the subject too.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.