The one i use is like the one sjravee describes
<script language="javascript" src="jscripts/_make_businessdropdowns.js"></script>
<script language="javascript">
function set_business_function(ranges, values) {
selectedIndex = 0;
var dropDown;
dropDown = document.f.businessfunction;
if (dropDown) {
dropDown.length = 0;
for(index=0; index<ranges.length; index++) {
dropDown[index] = new Option(ranges[index],values[index], false, false);
}
dropDown.options[selectedIndex].selected = true;
}
}
</script>
the function is called by onchange in the master select:
<select name='busunit' onChange="set_business_function(_business_unit_function[this.selectedIndex], _business_unit_function_number[this.selectedIndex]);" >
child select:
<select name="businessfunction">
<option value="1000">
</option>
</select>
and uses the _make_businessdropdowns.js which I build from a database and is a 2d array but which looks like:
_business_unit_function = new Array();
_business_unit_function_number = new Array();
// defautl menu structure
_business_unit_function[0] = new Array('All or Select A Business Unit Community','');
_business_unit_function_number[0] = new Array(1000,1000);
_business_unit_function[1] = new Array('All or Select A Business Unit Community','Retail Wide News');
_business_unit_function_number[1] = new Array(1000,1000);
_business_unit_function[2] = new Array('All or Select A Business Unit Community','Indirect Channels');
_business_unit_function_number[2] = new Array(1000,1);
_business_unit_function[3] = new Array('All or Select A Business Unit Community','BT Openworld');
_business_unit_function_number[3] = new Array(1000,1000);
_business_unit_function[4] = new Array('All or Select A Business Unit Community','Northern Ireland','Scotland','North East Region','North West Region','Yorkshire & Humberside Region','West Midlands Region','East Midlands Region','East of England Region','London','South East Region','South West Region','Wales');
_business_unit_function_number[4] = new Array(1000,2,3,4,5,6,7,8,9,10,11,12,13);