<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Test 2 comboboxes</title>
<script type="text/javascript">
function loadComboBox2()
{
//debugger;
var combobox1 = document.getElementById("combobox1");
var combobox2 = document.getElementById("combobox2");
if(combobox1.value == "0")
{
combobox2.disabled = true;
alert("SELECT AN ITEM IN COMBOBOX 1");
}
else if(combobox1.value == "one")
{
combobox2.options.length = 0;
combobox2.options[combobox2.options.length] = new Option("one","one");
combobox2.disabled = false;
}
else if(combobox1.value == "two")
{
combobox2.options.length = 0;
combobox2.options[combobox2.options.length] = new Option("two","two");
combobox2.options[combobox2.options.length] = new Option("two","two");
combobox2.disabled = false;
}
else if(combobox1.value == "three")
{
combobox2.options.length = 0;
combobox2.options[combobox2.options.length] = new Option("three","three");
combobox2.options[combobox2.options.length] = new Option("three","three");
combobox2.options[combobox2.options.length] = new Option("three","three");
combobox2.options[combobox2.options.length] = new Option("three","three");
combobox2.disabled = false;
}
else if(combobox1.value == "other")
{
combobox2.options.length = 0;
combobox2.options[combobox2.options.length] = new Option("aap","aap");
combobox2.options[combobox2.options.length] = new Option("tijger","tijger");
combobox2.options[combobox2.options.length] = new Option("konijn","konijn");
combobox2.options[combobox2.options.length] = new Option("leeuw","leeuw");
combobox2.options[combobox2.options.length] = new Option("krokodil","krokodil");
combobox2.disabled = false;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
ComboBox 1 :
</td>
<td>
<select id="combobox1" name="combobox1">
<option value="0" selected="selected">(please select:) </option>
<option value="one">one </option>
<option value="two">two </option>
<option value="three">three </option>
<option value="other">other </option>
</select>
</td>
<td>
<input type="button" value="Go" id="button1" name="button1" onclick="loadComboBox2()" />
</td>
</tr>
<tr>
<td>
ComboBox 2 :
</td>
<td>
<select id="combobox2" name="combobox2" disabled="disabled" />
</td>
<td>
<input type="button" value="Go" id="button2" name="button1" onclick="alert('Gekozen waarde :
' + combobox2.value);" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>