var Start Year = 1980;
var End Year = 2500;
function MonthAndDay()
{
this.initDDL = function(obj Year,objMonth,objDay,hid Year,hidMonth,hidDay)
{
this.init(obj Year,objMonth, objDay,hid Year,hidMonth,hidDay);
this.SelectChange(objyear,objMonth,objDay,hidyear,hidMonth,hidDay);
}
this.init = function(obj Year,objMonth,objDay,hid Year,hidMonth,hidDay)
{
var year = document.getElementById(obj Year);
var month = document.getElementById(objMonth);
var day = document.getElementById(objDay);
var me=this;
if(year.length == 1)
{
year.options[0] = new Option("無制限","");
for(var i = Start Year; i < End Year; i )
{
year.options[year.length] = new Option(i,i);
}
}
me.yearOptionsChange(document.all[obj Year].value,objyear,objMonth,objDay);
me.monthOptionsChange(document.all[obj Year].value,document.getElementById(objMonth).value,objDay);
}
this.yearOptionsChange = function(selectValue,obj Year,objMonth,objDay)
{
var month = document.getElementById(objMonth);
var day = document.getElementById(objDay);
var me=this;
month.length = 0;
日の長さ = 0;
month.options[0]=new Option("無制限",'');
day.options[0]=new Option("無制限",'');
if(selectValue == "")
{
return ;
}
for(var i = 1; i {
month.options[month.length] = new Option((i }
me.monthOptionsChange(document.getElementById(obj Year).value,document.getElementById(objMonth).value,objDay);
}
this.monthOptionsChange = function(yearSelectValue,monthSelectValue,objDay)
{
var day = document.getElementById(objDay);
var endDay;
日の長さ = 0;
day.options[0]=new Option("無制限",'');
if(monthSelectValue == "")
{
return;
}
if((parseInt(yearSelectValue) % 400 == 0) || (parseInt(yearSelectValue) % 4 == 0 && parseInt(yearSelectValue) % 100 != 0))
{
if(parseInt(monthSelectValue) == "2")
{
endDay = 29;
}
}
else
{
if(parseInt(monthSelectValue) == "2")
{
endDay = 28;
}
}
switch(parseInt(monthSelectValue))
{
ケース 1:
ケース 3:
ケース 5:
ケース 7:
ケース8:
ケース 10:
ケース 12:
endDay = 31;
休憩;
ケース 4:
ケース 6:
ケース 9:
ケース 11:
endDay = 30;
休憩;
}
for(var i = 1; i {
day.options[day.length] = new Option((i }
}
this.SelectChange = function(obj Year,objMonth,objDay,hid Year,hidMonth,hidDay)
{
var year = document.all[obj Year];
var month = document.all[objMonth];
var day = document.all[objDay];
var me = this;
year.onchange = function()
{
me.yearOptionsChange(this.options[this.selectedIndex].value,objyear,objMonth,objDay);
document.all[hid Year].value = this.options[this.selectedIndex].value;
document.all[hidMonth].value = "";
document.all[hidDay].value = "";
}
month.onchange = function()
{
me.monthOptionsChange(document.all[hid Year].value,this.options[this.selectedIndex].value,objDay) ;
document.all[hidMonth].value = this.options[this.selectedIndex].value;
document.all[hidDay].value = "";
}
day.onchange = function()
{
document.all[hidDay].value = day.selectValue;
}
}
}