J
John Ciccone
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?
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?