Click to See Complete Forum and Search --> : pull down problem


slimshady
11-05-2003, 02:28 PM
Hi,
I have a pull down box just normal HTML without any javascript
like this

<select>
<option value="www.tmf.nl">tmf</option>
<option value="www.radio.nl">radio</option>
<option value="www.tv.nl">tv</option>
</select>

I have a script working inside it that if one option is selected it automatticly launches a function but the problem is the function is connected and depending on the selected value of the pull down.
what i need is a way to launch a function when option tmf is selected and launch another function when radio is selected

so what i mean is something like this(below code is my fantasy of what i mean it does not work)

<select OnChange="launch(this.form)>
<option value="www.tmf.nl">tmf</option>
<option OnClick="document.form.url.value=radio value="www.radio.nl">radio</option>
<option value="www.tv.nl">tv</option>
</select>

Khalid Ali
11-05-2003, 04:17 PM
you can use javascript string objects indexOf function where you pass the string to look for in a long string.
if the string is present it will return the undex at where that string in sin the long string or else it will return -1

here is how you can set it up for your problem
get teh value from the listbox
var val = "www.tmf.nl";

//now look for tmf

if(val.indexOf("tmf")>-1){
//do something here
}else ifif(val.indexOf("radio")>-1){
//do something here
}

slimshady
11-07-2003, 04:16 PM
You really helped me out there!!!
major thanx to you you put my brain in a less painfull situation
it works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thank you