Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

easy dropdown question 2

Status
Not open for further replies.

MikeT

IS-IT--Management
Feb 1, 2001
376
US
I can reference the value of a text box like this:
document.formname.textboxname.value

How do I reference the values AND labels of a dropdown?

Thanks
(Hey I'm new!)
 
Hi.
<Select name=&quot;OpName&quot; id=&quot;OpName&quot; onchange=&quot;isSelect()&quot;>
<Option value=&quot;1&quot;>One
<Option value=&quot;2&quot;>Two
<Option value=&quot;3&quot;>Three
</Select>

<Script Language=&quot;JavaScript&quot;>
function isSelect()
{
var value=document.all[&quot;OpName&quot;].value;
var text=document.all[&quot;OpName&quot;].text;

}
</Script>

regards, Kirilla
 
How can I access different options?
 
Lets say my dropdown has 5 different options(choices), how would I access the 4th option if I had to?
I thought it was something like
document.formname.selectname.index
or
document.formname.selectname.option(index)

Am I on drugs or what?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top