In VBScript how would someone get the text value from a pulldown
select/option list in HTML?

If you look at the following html, I would like to get the text of
whatever is selected. "One" instead of "1". How would I go about doing
that in VBScript?

<form name="myform">
<select name="selectname">
<option value="1">One</option>
<option value="2">Two</option>
</select>

thanks for any help in advance,
Geoff

Re: Getting Text and Value From Option/Select by McKirahan

McKirahan
Wed Oct 06 10:52:28 CDT 2004

"Geoff Robinson" <geoffr2@aol.com> wrote in message
news:978b35e2.0410060734.4223c410@posting.google.com...
> In VBScript how would someone get the text value from a pulldown
> select/option list in HTML?
>
> If you look at the following html, I would like to get the text of
> whatever is selected. "One" instead of "1". How would I go about doing
> that in VBScript?
>
> <form name="myform">
> <select name="selectname">
> <option value="1">One</option>
> <option value="2">Two</option>
> </select>
>
> thanks for any help in advance,
> Geoff

document.myform.selectname.options(document.myform.selectname.selectedIndex)
.value

as in

<html>
<head>
<title>selected.htm</title>
<script type="text/vbscript">
Sub selected()
window.status =
document.myform.selectname.options(document.myform.selectname.selectedIndex)
.value
End Sub
</script>
</head>
<body>
<form name="myform">
<select name="selectname">
<option value="1">One</option>
<option value="2">Two</option>
<input type="button" value="?" onclick="selected()">
</select>
</form>
</body>
</html>



Re: Getting Text and Value From Option/Select by McKirahan

McKirahan
Wed Oct 06 10:54:01 CDT 2004

"McKirahan" <News@McKirahan.com> wrote in message
news:0xU8d.190812$MQ5.8956@attbi_s52...
> "Geoff Robinson" <geoffr2@aol.com> wrote in message
> news:978b35e2.0410060734.4223c410@posting.google.com...
> > In VBScript how would someone get the text value from a pulldown
> > select/option list in HTML?
> >
> > If you look at the following html, I would like to get the text of
> > whatever is selected. "One" instead of "1". How would I go about doing
> > that in VBScript?
> >
> > <form name="myform">
> > <select name="selectname">
> > <option value="1">One</option>
> > <option value="2">Two</option>
> > </select>
> >
> > thanks for any help in advance,
> > Geoff
>
>
document.myform.selectname.options(document.myform.selectname.selectedIndex)
> .value

Ooops, change that to:

document.myform.selectname.options(document.myform.selectname.selectedIndex)
.text



Re: Getting Text and Value From Option/Select by geoffr2

geoffr2
Thu Oct 07 08:02:46 CDT 2004

Thanks a bunch.
>
> Ooops, change that to:
>
> document.myform.selectname.options(document.myform.selectname.selectedIndex)
> .text