Probably me being blind and missing something obvious, but I just can't get this function to work. It's supposed to show or hide elements, or change their opacity depending on the variables given to it. Code: //Shows or hides elements function display(elementid,show,fade,opacity) { switch(show) { case 1: if(fade=1) { document.getElementById(elementid).style.display = "inline"; //Standard document.getElementById(elementid).style.opacity = opacity / 100; //IE Legacy document.getElementById(elementid).style.filter = "alpha(opacity="+opacity+")"; } else { document.getElementById(elementid).style.display = "inline"; } break; case 0: { document.getElementById(elementid).style.display = "none"; } break; } } So for example if I run the function Code: display('foo',1,1,40); It should change the element Code: <span id="foo">bar</span> To 40% opacity. Except..... it doesn't. Any ideas?
works fine here... The problem might actually be the way you're including the script in the page. Post some of the HTML as well?