Click to See Complete Forum and Search --> : very simple list/menu question


Gasolene
07-24-2003, 03:17 PM
simple question...


I have drop menu with labels & values.

to get the value i use mydocument.myform.mymenu.value
but how do i get the label??

Khalid Ali
07-24-2003, 03:42 PM
:confused:

your question is a bit confusing..what are labels...????please elaborate

Gasolene
07-24-2003, 04:15 PM
here is the list/menu component:

------------------------------------------------------

<select name="mymenu" onChange="Update();">
<option value="0" selected>textLabel1 Space</option>
<option value="4.95">textLabel2 </option>
<option value="15.95">textLabel3 </option>
<option value="34.95">textLabel4 </option>
<option value="124.95">textLabel5 </option>
<option value="199.95">textLabel6 </option>
</select>

------------------------------------------------------

mydocument.myform.mymenu.value returns the value
ie: 15.95

but i want to know if its possible to return the label
ie: textlabel3

this is possible in actionscript & C+, but i dont know if its possible in javascript.

Charles
07-24-2003, 04:31 PM
<select name="mymenu" onchange="alert(this[this.selectedIndex].firstChild.data)">
<option value="0" selected>textLabel1 Space</option>
<option value="4.95">textLabel2 </option>
<option value="15.95">textLabel3 </option>
<option value="34.95">textLabel4 </option>
<option value="124.95">textLabel5 </option>
<option value="199.95">textLabel6 </option>
</select>