[Javascript] simple array

BEKIM BACAJ Trojani2000 at hotmail.com
Wed May 2 21:21:48 CDT 2001


If you like to cycle one by one you have to use some init event for that.

with the for statement all you can manage is to cycle to the last contentn
of you're variables, and have it displayed as it was the first and the last one!
If you like it to cycle with time intervals you have to use the time interval, else you can use the timeout of displaying
the current content\n.
or if you need to use the click event than you want be needing timers
you have to create a click counter as a simple solution
or if you like to use the onmouseover event, than you can simplify it with event.srcElement
for exaple some titles you mouse over that changes the, -for instance, <div> content
but before I write any script for you I have to know the real purpose.

until next time
Cheers



----- Original Message -----
From: Thomas Wheeler
Sent: Thursday, May 03, 2001 2:15 AM
To: Javascript at LaTech.edu
Subject: [Javascript] simple array


Trying to learn, if I have a series of variables like content1, content2, etc..  and I want to cycle through them
can I write a for loop?  Here's my current code:

                  if (obj != content1) hide(content1);
  if (obj != content2) hide(content2);
  if (obj != content3) hide(content3);
  if (obj != content4) hide(content4);
  if (obj != content5) hide(content5);
  if (obj != content6) hide(content6);
   
Here's what I've been trying to do:

function show(obj) {   
          //show the obj here
          for(i = 1; i < 7; i++)
                  if (obj != content + [i]) hide(content + [i]);
}

this doesn't work, and other variations of it I've tried are also unsuccessful.  I know I could list all the variables, but isn't there a more concise way?  

Tom Wheeler


_______________________________________________
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/20010503/30ce8e0b/attachment.htm>


More information about the Javascript mailing list