I thought this would be simple I am trying tochange the opacity using style. but keeps throwing an error

document.getElementById('overlay').style.background='#000';
document.getElementById('overlay').style.opacity='40';
document.getElementById('overlay').style.filter='alpha(opacity=40)';

keeps thowing the error in parsing value for 'filter' declaration dropped

in my css i have

#overlay{
 width: 100%;
 height: 100%;
 background: transparent;
  /* for IE */
  filter:alpha(opacity=100);
  /* CSS3 standard */
  opacity:1.0;
 z-index: 102;
}

might seem like a silly question sorry I am just starting to experiment with javascript

.style.opacity = 0.4;
.style.filter = "alpha(opacity=40)";

thank you fxm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.