glenelkins Posted April 22, 2007 Share Posted April 22, 2007 Hi Trying to set opacity on a link click, my javascript code is : function Dimm () { var divId='outer'; div=document.getElementById(divId);setOpacity(div,50); } It does not work!; Link to comment https://forums.phpfreaks.com/topic/48106-opacity/ Share on other sites More sharing options...
shaymol Posted April 22, 2007 Share Posted April 22, 2007 Hi mates You can try with the following method for setOpacity function setOpacity( element, alpha ) { var style = element.style; if( style.MozOpacity != undefined ) { //Moz and older style.MozOpacity = alpha; } else if( style.filter != undefined ) { //IE style.filter = "alpha(opacity=0)"; element.filters.alpha.opacity = ( alpha * 100 ); } else if( style.opacity != undefined ) { //Opera style.opacity = alpha; } } Thanks ShaymoL Link to comment https://forums.phpfreaks.com/topic/48106-opacity/#findComment-235099 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.