Help with timeout

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Help with timeout
blaa_blaa_69
CZ Newbie
blaa_blaa_69 has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: May 04, 2004
0.00 posts per day
Posts: 1
Points: 104
   
icon_mad.gif
icon_mad.gif icon_mad.gif hey guys i need some help with this. I am trying to make each image fade in one after another. Eg the left image fades in, then the next the next.
I have written this simple script to do it, and if i check the activity log it has loaded the images, but by the time the page is loaded it is on the last image. So I cant get the timeout to work??

<script LANGUAGE="JavaScript">
<!--
if (document.images != null) {
pic0 = new Image();pic0.src = "two0.gif";
pic1 = new Image();pic1.src = "two1.gif";
pic2 = new Image();pic2.src = "two2.gif";
pic3 = new Image();pic3.src = "two3.gif";
pic4 = new Image();pic4.src = "two4.gif";
pic5 = new Image();pic5.src = "two0.gif";
pic6 = new Image();pic6.src = "two1.gif";
pic7 = new Image();pic7.src = "two2.gif";
pic8 = new Image();pic8.src = "two3.gif";
pic9 = new Image();pic9.src = "two4.gif";
pic10 = new Image();pic10.src = "two0.gif";
pic11 = new Image();pic11.src = "two1.gif";
pic12 = new Image();pic12.src = "two2.gif";
pic13 = new Image();pic13.src = "two3.gif";
pic14 = new Image();pic14.src = "two4.gif";
}

function fadeIn() {
for(i=0; i<15; i++) {
if (i < 5) {
document.images['pic1'].src = eval('pic' + i + ".src");
}
if (i < 10) {
document.images['pic2'].src = eval('pic' + i + ".src");
}
if (i < 15) {
document.images['pic3'].src = eval('pic' + i + ".src");
}
}
setTimeout('fadeIn()',50);
}

//-->
</SCRIPT>



</HEAD>

<BODY onload="fadeIn()">


<A HREF="#"><IMG SRC="two0.gif" NAME="pic1" BORDER=0 WIDTH=21 HEIGHT=21></A>
<A HREF="#"><IMG SRC="two0.gif" NAME="pic2" BORDER=0 WIDTH=21 HEIGHT=21></A>
<A HREF="#"><IMG SRC="two0.gif" NAME="pic3" BORDER=0 WIDTH=21 HEIGHT=21></A>
<A HREF="#"><IMG SRC="two0.gif" NAME="pic4" BORDER=0 WIDTH=21 HEIGHT=21></A>
<A HREF="#"><IMG SRC="two0.gif" NAME="pic5" BORDER=0 WIDTH=21 HEIGHT=21></A>



Back to top Reply with quote
#2   re: Help with timeout
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
setTimeout('fadeIn()',50);


Is about a half a millisecond. try 5000 that 5 seconds.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum