Setting the IE opacity ;)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to set the opacity of a div, it works with FF and with
Safari but not with IE7:
The page (which has been reduced) is:

Using IE7, we enter inside the "if" of the function:

function change_opa(i) {
  if(document.all) {
    alert("dans if") ;
  } else {
    alert("dans else") ;
    document.getElementById('main-data').style.opacity = 3/10 ;


But IE7 does not do the .style.filter...

Any idea ?


PS: Sorry for the alert('') which takes all the page!

Re: Setting the IE opacity ;)

Quoted text here. Click to load it

This is no good test at all. Use JScript’s conditional compilation or
conditional comments in your HTML.

Quoted text here. Click to load it

The div element doesn’t have layout.

MSDN on filters:
“[…] the object that the filter is applied to must have layout before
the filter effect will display […]”

MSDN on hasLayout:

  zoom: 1;

has the least side effects.

Re: Setting the IE opacity ;)

Defacta wrote:
Quoted text here. Click to load it

Went to your link with Fedora 10, Firefox 3.0.6 and after a short wait,
the alert box appeared then the text grayed.  Clicked "OK" on the alert
box and after a couple more seconds it reappeared.

"If people are good only because they fear punishment, and hope for
reward, then we are a sorry lot indeed." [Albert Einstein]

Site Timeline