[thelist] Re: javascript: for-in loop and split [solved]

Tom Dell'Aringa pixelmech at yahoo.com
Thu Feb 20 14:54:04 CST 2003


--- Tom Dell'Aringa <pixelmech at yahoo.com> wrote:
> I have a date string that I have split based on the slash:
>
> var date = "1/1/2000"
> var chkslashpos = date.split('/')
>
> What I wanted to do was then use a for-in loop to grab each number,
> but I can't quite get it. I tried:
>
> for(var i in chkslashpos)
> {
>    alert(chkslashpos)
> }
>
> Which just gives me the whole thing three times. Isn't there a way
> to use this to get 1, 1, and 2000?

Bah! Wheres the "mail unsend" button! LOL. Found the answer 60
seconds later:

for(var i in chkslashpos)
{
   alert(chkslashpos[i]) //since of course it is now an array...
}

Tom

=====
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
http://www.pixelmech.com/
var me = tom.pixelmech.webDeveloper();

http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/



More information about the thelist mailing list