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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change the options of Dropdown item ?

Status
Not open for further replies.

Minh

Technical User
Oct 4, 2001
1
US
I have the code below . There are a "drop down" box ( or list box ) and a command button in my webpage.
In my box has 3 options (rock,rap ...) , then I click the command button and I want it to change the content of the option in the list box ( become horror, comedy, comic ... ).
But when I write the function change , I don't know what command I should use .

I hope that someone can help me .Thanks



<HTML>
<BODY>

<P>
<SELECT name=category style=&quot;HEIGHT: 22px; WIDTH: 119px&quot; id=category ><OPTION selected
value=&quot;&quot;>All<OPTION
value=0>Action <OPTION
value=1>Horror<OPTION
value=2>Comedy</OPTION>
</SELECT>


<INPUT id=button name=button type=button value=&quot;change content of the list&quot; onclick=&quot;change()&quot;></P>

</BODY>
<SCRIPT LANGUAGE = &quot;vbscript&quot;>
<!--
sub change()


document.datain.category.options= ????
' If I click button ...
' The 'category' dropdown control will change its options
' from
' <SELECT name=category style=&quot;HEIGHT: 22px; WIDTH: 119px&quot; id=category onclick=&quot;change()&quot;><OPTION selected
' value=&quot;&quot;>All<OPTION
' value=0>Action <OPTION
' value=1>Horror<OPTION
' value=2>Comedy</OPTION>
' </SELECT>
' to
' <SELECT name=category style=&quot;HEIGHT: 22px; WIDTH: 119px&quot; id=category onclick=&quot;change()&quot;><OPTION selected
' value=&quot;&quot;>All<OPTION
' value=0>rock <OPTION
' value=1>rap<OPTION
' value=2>country</OPTION>
' </SELECT>

end sub


-->
</SCRIPT>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top