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

runtime filling up of dropdown menu

Status
Not open for further replies.

kshk

Programmer
Aug 28, 2002
8
IN
how to fill up a drop down menu during run time based on a certain event such as clicking a button?
 
Dear Friend

You can Use The following Code :

<script language=&quot;javascript&quot;>

function selectA() {
var selA = document.test.typeA.value;
var objB = document.test.typeB;
objB.options.length = 0;
if (selA=='A') {
objB.options[0] = new Option('A1','A1');
objB.options[1] = new Option('A2','A2');
objB.options[2] = new Option('A3','A3');
}else if (selA=='B') {
objB.options[0] = new Option('B1','B1');
objB.options[1] = new Option('B2','B2');
objB.options[2] = new Option('B3','B3');
}else if (selA=='C') {
objB.options[0] = new Option('C1','C1');
objB.options[1] = new Option('C2','C2');
objB.options[2] = new Option('C3','C3');
}
}

</script>

test is the name of my form and typeA is the first Combo box and typeB is the second combo box, also you can call this function with one button and one combo box, if you have any question please email me

Regards
Shahroozj@Hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top