I would use the function called split() which makes an array based on a
delimiter passed in (in your case the comma). Then you can loop over the
array or access the elements as you need:


var x = 'test1,test2,test3,test4';


arElements = x.split(',');


would result in...


arElements[0] = 'test1'
arElements[1] = 'test2'
arElements[2] = 'test3'
arElements[3] = 'test4'


HTH,


Mike

  _____  

From: Andrew Scott [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 18, 2003 10:03 PM
To: CF-Talk
Subject: _javascript_ Help

Looking for any help in being able to do the following.

I am looking at a string "test,test1,test2,test3", and what I would like to
do is get the value of these from the form variable sounds simple enough.
But how to I get the item out of the string using _javascript_. In coldfusion
I would used ListGetAt, but I can't seem to find anything in JS to do this.

Regards
Andrew Scott
Technical Consultant

NuSphere Pty Ltd
Level 2/33 Bank Street
South Melbourne, Victoria, 3205

Phone: 03 9686 0485  -  Fax: 03 9699 7976
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to