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"> </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">
<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>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.