Ok, hopefully this is a bit easier: I have a select control on my page, something like this:
And I came up with this little javascript to simply pop up an alert for the selected item:
There is a button in the form like this:
<input type="normal" name="button1" onClick="ShowAll()">
The only problem I have with this, is the alert value is not the text but the actual item value (du). So I'm wondering if anyone knows how to get the long text from the the select box instead of the item value?
Code:
<select name=promolist size=7 id=plist> <option value='000001'>Option 1</option> <option value='000002'>Option 2</option> <option value='000003'>Option 3</option> .... </select>
Code:
function ShowAll() { len = document.promos.promolist.length i = 0 chosen = "none" for (i = 0; i < len; i++) { if (document.promos.promolist[i].selected) { chosen = document.promos.promolist[i].value } } alert(chosen); return false; } </script>
<input type="normal" name="button1" onClick="ShowAll()">
The only problem I have with this, is the alert value is not the text but the actual item value (du). So I'm wondering if anyone knows how to get the long text from the the select box instead of the item value?
Comment