Switch to full style
HTML,DHTML,Javascript,XML,CSS
Post a reply

JavaScript fade out problem

Mon Apr 02, 2012 7:28 am

Hi! I'd need some helps with my JavaScript. I want three texts to fade in and fade out after each other in different places. Currenlty the texts fade in as I want, but then thet stay there and don't fade out. I know there's some faults in my code but I'm not adequately good to know how to correct it. Thank you

<div id="fader" style="font:15px Calibri;width:43%; color:rgb(255,255,255);" class="style3"></div><br/>
<span lang="fi">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
<br/><div id="fader2" style="font:15px Calibri;width:45%; color:rgb(255,255,255); float:right" class="style1"></div><br/><br/>
<span lang="fi">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div id="fader3" style="font:15px Calibri;width:51%; color:rgb(255,255,255);" class="style2"></div>
</span>
</div>

<td id="spacertd" width="15"></td>
<td id="rightcolumn" valign="top">

<script language="JavaScript1.2">
opacity = 0.0;
var inc=-1;

function fadingtext(){
if(opacity != 1.0) {
opacity += 0.1;
document.getElementById("fader").style.opacity = opacity;
document.getElementById("fader2").style.opacity = opacity;
document.getElementById("fader3").style.opacity = opacity;
setTimeout("fadingtext()",20);
}
else
opacity = 0.0;
}

function changetext(){
if (!document.getElementById) return
inc++
if (inc==0)
document.getElementById("fader").innerHTML="Text1"
else if (inc==1)
document.getElementById("fader2").innerHTML="Text2"
else{
document.getElementById("fader3").innerHTML="Text3"
inc=-1
}
fadingtext()
setTimeout("changetext()",2300)
}
window.onload=changetext

</script>



Post a reply
  Related Posts  to : JavaScript fade out problem
 Fade-In, Fade-out and Fade-toggle with time control     -  
 Problem with BMI calcualtor in JavaScript     -  
 I'm having a problem creating a Javascript form. Whats wrong     -  
 MVC problem....     -  
 i have problem     -  
 Paging problem in php     -  
 JSTL URI problem     -  
 Window 7 problem....     -  
 Windows problem!!!     -  
 Problem with skymiles_red     -