Use the split() method. This creates a array that you can loop through.
var list = "O,B/O,S,H";
var listArray = list.split(",");
----- Original Message -----
From: Thane Sherrington <[EMAIL PROTECTED]>
Date: Friday, January 17, 2003 11:54 am
Subject: -OT- Javascript and lists
> How do I look through a list of strings in Javascript and compare
> each to a
> variable? I'm trying to do the following:
>
> Set up a list like this "O,B/O,S,H"
>
> And then loop through and compare each the data in a form field
> and if the
> form field doesn't match any of the choices, have it throw an alert.
>
> T
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4