hey all
I've got two drop down menus that i want to change based on the month selected in the first drop down to show only the days that actually exist in teh secodn drop down.
Unfortueantly it'll jsut populatte the largest array and thats' that.
Tried havign it so the array is cleared after the array is populated and printed to the screen, but to no avail
here's the code:
Code:
function populate(m,d) {
d.options.length = 0;
if (m.selectedIndex == 0) {
d.options[0] = new Option("Select All");
}
if (m.selectedIndex == 1 || 3 || 5 || 7 || 8 || 10 || 12) {
d.options[0] = new Option("1","1");
d.options[1] = new Option("2","2");
d.options[2] = new Option("3","3");
---snip snip ----
d.options[28] = new Option("29","29");
d.options[29] = new Option("30","30");
d.options[30] = new Option("31","31");
}
if (m.selectedIndex == 2) {
d.options[0] = new Option("1","1");
d.options[1] = new Option("2","2");
d.options[2] = new Option("3","3");
---snip snip ----
d.options[27] = new Option("28","28");
d.options[28] = new Option("29","29");
}
if (m.selectedIndex == 4 || 6 || 9 || 11) {
d.options[0] = new Option("1","1");
d.options[1] = new Option("2","2");
d.options[2] = new Option("3","3");
---snip snip ----
d.options[26] = new Option("27","27");
d.options[27] = new Option("28","28");
d.options[28] = new Option("29","29");
d.options[29] = new Option("30","30");
}
if (document.layers) {history.go(0);}
}
function changepg() {
if (document.search.day.value) {
location = document.search.day.value;
}
}
// -->
</head>
<body>
<form action="search.asp" name="search" id="search" method="POST">
<select name="month" onchange="populate(document.search.month, document.search.day);">
<option value='%'>Select All</option>
<option value='1'>January</option>
<option value='2'>Febuary</option>
<option value='3'>March</option>
<option value='4'>April</option>
<option value='5'>May</option>
<option value='6'>June</option>
<option value='7'>July</option>
<option value='8'>August</option>
<option value='9'>September</option>
<option value='10'>October</option>
<option value='11'>November</option>
<option value='12'>December</option>
</select>
<select name="day" id="day">
<option></option>
</select>
<input type="button" value="Go!" onclick="changepg()" />
</form>
</body>
</html> thanks in advance