| Ronny K.S. Wong Fat 2007-10-28, 7:17 pm |
| Try this one,
<title>Ronny K.S. Wong Fat</title>
<body>
<form name="AutoListBox">
<p><select name="ListBoxURL" size="1" language="javascript"
onchange="gotoLink(this.form);">
<option value="URL#1.htm">Place 1 </option>
<option value="URL #2.htm">Place 2 </option>
<option value="URL#3.htm">Place 3 </option>
<option selected> -- Select to Jump -- </option>
</select></p>
<script language="JavaScript">
<!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script>
</form>
</body>
"John Ciccone" wrote:
> How in the world do I get the value of a dropdown list box? If the list
> options are:
>
> Apple
> Orange
> Banana
>
> and I select Orange, what is the value? e.g. I have a
>
> function sendform()
> {
> with (document.form1)
> if (DropList.value = "Apple")
> {
> Field1.value = "It's an apple"
> }
> else if (DropList.value = "Orange")
> {
> Field1.value = "It's an orange"
> }
> else
> {
> Field1.value = "It's banana"
> }
> }
>
> When I try the above, no matter what I select, all it does is make the drop
> down list box "Apple", and "It's an apple" is inserted into the field.
>
> I've tried assuming each item in the list is a number, but that doesn't work
> either.
>
> By the way, I'm cutting/pasting from a sample form that does work. I don't
> see any "End if". Is that not necessary in HTML?
|