/////////////////////////////////////////////////////
//////
// 函数说明:年份下拉列表生成函数 FnBuildYear(selectname,chosedyear)
// 函数设计:苏永东
// 设计日期:2002-10-29
// 输入参数:;chosedyear表示默认选择哪一年/月为默认选中年/月,如果为空,则表示当前年/月为选中
/////
function FnCreateYearMonthDay()
{
var InputArgArray = FnCreateYearMonthDay.arguments
var selyearname = InputArgArray[0] //生成下拉列表的id名字(年份)
var chosedyear = InputArgArray[1] //修正值(年份)
var selmonthname = InputArgArray[2] //生成下拉列表的id名字(月份)
var chosedmonth = InputArgArray[3] //修正值(月份)
var seldayname = InputArgArray[4] //生成下拉列表的id名字(日)
var chosedday = InputArgArray[5] //修正值(日)
var beginyear = InputArgArray[6] //开始年份(修正值,和当前年份)-10
var endyear = InputArgArray[7] //结束年份(修正值,和当前年份)+5
var argumenetslength = InputArgArray.length
var outstr //输出字符串
var begin_year = 2009 //开始年
outstr = “”
var today = new Date();
if (argumenetslength==4)
{
//简单类型:只有年月
//年份
outstr += ‘<select id=”‘ + selyearname + ‘” name=”‘ + selyearname + ‘”>’
var todayyear = today.getYear()
var End_year=todayyear+10;
if(chosedyear!=null&&chosedyear!=”)
{
todayyear += chosedyear
}
for (i=begin_year;i<=End_year;i++)
{
if (i==todayyear)
{
outstr = outstr + ‘<option value=”‘ + i + ‘” selected>’ + i + ‘年</option>’
}else{
outstr = outstr + ‘<option value=”‘ + i + ‘”>’ + i+ ‘年</option>’
}
}
outstr = outstr + ‘</select>’
//月份
outstr = outstr + ‘<select id=”‘ + selmonthname + ‘” name=”‘ + selmonthname + ‘”>’
var todaymonth = today.getMonth() + 1
if(chosedmonth!=null&&chosedmonth!=”)
{
todaymonth += chosedmonth
}
for (i=1;i<=12;i++)
{
if (i==todaymonth)
{
outstr = outstr + ‘<option value=”‘ + FnFormatLessTen(i) + ‘” selected>’ + FnFormatLessTen(i) + ‘月</option>’
}else{
outstr = outstr + ‘<option value=”‘ + FnFormatLessTen(i) + ‘”>’ + FnFormatLessTen(i) + ‘月</option>’
}
}
outstr = outstr + ‘</select>’
}else{
if (argumenetslength==6)
{
//复杂类型 //年月日
//年份
outstr += ‘<select id=”‘ + selyearname + ‘” name=”‘ + selyearname + ‘” onchange =”FnResetTrueDate(\” + selyearname + ‘\’,\” + selmonthname + ‘\’,\” + seldayname +’\')” >’
var todayyear = today.getYear()
var End_year=todayyear+10;
if(chosedyear!=null&&chosedyear!=”)
{
todayyear += chosedyear
}
for (i=begin_year;i<=End_year;i++)
{
if (i==todayyear)
{
outstr = outstr + ‘<option value=”‘ + i + ‘” selected>’ + i + ‘年</option>’
}else{
outstr = outstr + ‘<option value=”‘ + i + ‘”>’ + i+ ‘年</option>’
}
}
outstr = outstr + ‘</select>’
//月份
outstr = outstr + ‘<select id=”‘ + selmonthname + ‘” name=”‘ + selmonthname + ‘” onchange =”FnResetTrueDate(\” + selyearname + ‘\’,\” + selmonthname + ‘\’,\” + seldayname +’\')” >’
var tod
···
···