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

How do I dynamically modify the contents of a list box?

Status
Not open for further replies.

billygronk

Programmer
Jun 11, 1999
1
GB
I want to modify the contents of a drop down list box based on a previous selection of a user so that when they choose an option from the first list box the contents will change in the second. Can anyone help?
 
The following script SHOULD insert a value "value" as a new last option at the end of the first &lt;select&gt; in the first &lt;form&gt; on a web page when the function insertvalue(value) is called (please let me know if you find any glitches...POST ANY ERROR MESSAGES):<br>
<br>
&lt;script language=JavaScript&gt;<br>
&lt;!--;<br>
function insertvalue(value)<br>
{<br>
var leng=document.forms[0].selects[0].length<br>
document.forms[0].selects[0].options[leng]=value<br>
}<br>
//--&gt;<br>
&lt;/script&gt;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top