Ok i want to setup select boxes for year, month and day. it starts with only year showing. when anything other than index0 is selected them month appears. same for that then day appears. if i set month back to index0 then day resets to index0 and hides itself like i want. however when i set year to index0 the month resets and hides but the day only resets and doesnt hide.
I think the problem is that because you have two if() tests, the day selection option is being hidden as expected in the first if() test but is then switched back on again in the second if() test; when you call the fromDate() option it might be better to check which menu called the function and only run one of the if() tests. While you're trying to resolve the problem, it might be a good idea to put some alert()s in each branch of the two if() tests to see what's happening. Because of the way browsers and their graphics libraries work, a menu can be hidden in one part of the code and then displayed in another part of the code without it looking like it was ever hidden in the first place, because of the speed at which the operation is carried out by the JavaScript engine. If you put alerts()s before and after a specific action, you can artificially slow down the process. Of course, echo()ing out variables to the browser is generally frowned upon when talking about good programming practice, but just do whatever you need to to solve the problem
function yDate(agg,bgg,cgg){
var yx=document.getElementById(cgg).selectedIndex;
if (yx != 0){
document.getElementById(bgg).style.display="inline";
document.getElementById(bgg).disabled=false;
}
else {
document.logfilters.logday.selectedIndex = "0";
document.logfilters.logmonth.selectedIndex = "0";
document.getElementById(agg).style.display="none";
document.getElementById(agg).disabled=true;
document.getElementById(bgg).style.display="none";
document.getElementById(bgg).disabled=true;
}
}
function mDate(ahh,bhh){
var mx=document.getElementById(bhh).selectedIndex;
if (mx != 0){
document.getElementById(ahh).style.display="inline";
document.getElementById(ahh).disabled=false;
}
else {
document.logfilters.logday.selectedIndex = "0";
document.getElementById(ahh).style.display="none";
document.getElementById(ahh).disabled=true;
}
}
i tried to make 1 more addition of a variable but then it doesnt work.. i tried to create this line
var vhh = 'document.logfilters.'+ahh+'.selectedIndex = ';vhh+"0";
but it doesnt work though. any ideas on this?
While you're trying to resolve the problem, it might be a good idea to put some alert()s in each branch of the two if() tests to see what's happening. Because of the way browsers and their graphics libraries work, a menu can be hidden in one part of the code and then displayed in another part of the code without it looking like it was ever hidden in the first place, because of the speed at which the operation is carried out by the JavaScript engine. If you put alerts()s before and after a specific action,