Split Splits?

vampist

Fully Optimized
Messages
2,404
Location
USA
Alright what I am trying to do is spit a string.

original string is: 1-F-2-F-3-F-4
How many a user specifies so say they want two.
Splits to: 1,2

or say they want 3

How many a user specifies so say they want three.
Splits to: 1,2,3

Here is the tricky part.

I would like to send back a
Code:
document.getElementById(id).style.color="#FFF";
line.

See the var id would be the split string numbers.
How can I do this?

I know you can do this in PHP easy, but I have to have this part client side.
Aka handy dandy JavaScript.
For any help I get here is a thank you in advance. Thank you!
 

vampist

Fully Optimized
Messages
2,404
Location
USA
Alright so I changed the join character I used to " ". So now it strings off as 1 2 3 4.. etc.


So what I need to know is there a way I can tell JavaScript to take individual numbers one at a time in say a while or for statement?

Such as the strtok() from php.
 
Top