Possible Duplicate:
JavaScript: string contains
I have a postcode variable and want to use JS to add a location into a different variable when the postcode is changed/entered. So for example if ST6 is entered I would want Stoke North to be entered.
I somehow need to do an if statement to run through e.g.
if(code contains ST1)
{
location = stoke central;
}
else if(code contains ST2)
{
location = stoke north;
}
etc...
How would I go about this? It's not checking if 'code' equals a value but if it contains a value, I think this is my problem.