[Javascript] Looping

BEKIM BACAJ Trojani2000 at hotmail.com
Mon May 21 04:30:20 CDT 2001


You will not need a real loop here.

It can be done with simple count, and if this will get called by some event like click for instance,
and afterwards; -if you like, after the fifth show, the return to the 1st, this one will do very good,  
but if you, for some unkwnown reason,would like to cycle through 1,2,3,4,5, with only two images, -that I can't understand,  
without stopping, use the timer and adjust it to you're need's, just enable it by deleting the comment glyphs '//' infront of the timer x

So,
Count the clicks than...


             var j=0;

function countTo5(){

var intrv =1000;           // equals 1sec interval

      if(j<1){j++;
                     //point here to image one
      }
else if(j<5){j++;
                     //point to image two
      }
  else{j=1
                     //point here to image one
      }
//x=window.setTimeout('countTo5()', intrv)
}

Regards.

----- Original Message -----
From: Christopher J. Baldoza
Sent: Monday, May 21, 2001 6:07 AM
To: 'javascript at LaTech.edu'
Subject: [Javascript] Looping


Hi,
     I'm beginner with Javascript. Can anyone give me an example of  simple
Loop script. I want to look the script like this. I have 2 images and I want to
show the first images dependent to the given number and the max is 5 if the
given number for example is '1' then it will show the 1st image once and the
2nd image will be four times.
     Thanks in advance. :)

Thope

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript<br clear=all><hr>Get Your Private, Free E-mail from MSN Hotmail at <a href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010521/2c491d66/attachment.htm>


More information about the Javascript mailing list