Jump to content

Switch on the light in a room


niveanvp73

Recommended Posts

Hi...I have a function that connects a lightbulb with opacity of a picture. Click on the lightbulb and see how it works (only in IE7 or Firefox lower version than 3.0) here:http://wwwart.cz/lighton.html The problem is, it works in IE7, Firefox 2.1, but NOT in Firefox3.0.Has someone an idea what could be the cause?Here's code of the script:cc=0;function changeImage() /*this function creates the effect of switching on or off the bulb...*/{if (cc==0) {cc=1;document.getElementById('myimage').src="images/bulbon.gif";}else{cc=0;document.getElementById('myimage').src="images/bulboff.gif";}}dd=0;var c=0; /*c stands for opacity of the picture under the lightbulb*/var t;var t2;function timedOpacity(){if (dd==0){dd=1;fce()}else{dd=0;fce2()}}function fce(){clearTimeout(t2);document.getElementById('img').style.cssText = "opacity: " + (c / 100) + "; filter:alpha(opacity=" + c + ")";c=c+10;if (c>99) returnvar t=setTimeout("fce()",1);}function fce2(){clearTimeout(t);document.getElementById('img').style.cssText = "opacity: " + (c / 100) + "; filter:alpha(opacity=" + c + ")";c=c-10;if (c<0) returnvar t2=setTimeout("fce2()",1);}Thanks for any idea

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...