JS JavaScript 生成时间日期下拉列表
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
JS JavaScript 生成时间日期下拉列表
function FnCreateY earMonthDay()
{
var InputArgArray = FnCreateY earMonthDay.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 = 1999; //开始年
var today = new Date();
if (argumenetslength==6)
{
//复杂类型//年月日
//年份
outstr += '
var todayyear = today.getY ear();
todayyear = todayyear<1900 ? (todayyear+1900):todayyear;
var End_year=todayyear+10;
// if(chosedyear!=null&&chosedyear!='')
// {
// todayyear += chosedyear;
// }
for (var i=begin_year;i<=End_year;i++)
{
if (i==todayyear)
{
outstr = outstr + '';
}else{
outstr = outstr + '';
}
}
outstr = outstr + '';
//月份
outstr = outstr + '
var todaymonth = today.getMonth() + 1;
for (i=1;i<=12;i++)
{
if (i==todaymonth)
{
outstr = outstr + '';
}else{
outstr = outstr + '';
}
}
outstr = outstr + '';
//日期
outstr += '
var todayday = today.getDate();
var newdate=new Date(todayyear,todaymonth);
var datenum=newdate.getUTCDate();
for (i=1;i<=datenum;i++)
{
if (i==todayday)
{
outstr = outstr + ''
}else{
outstr = outstr + ''
}
}
outstr = outstr + ''
}
//总输出
document.write(outstr)
}
function FnFormatLessT en(in_number)
{
if (in_number<10)
{
return("0"+in_number)
}else{
return(in_number)
}
}
function FnResetTrueDate(yearid,monthid,dayid)
{
var tarobj = document.getElementById(dayid)
var temp_year=document.getElementById(yearid).value;
var temp_month=document.getElementById(monthid).value;
var temp_day=tarobj.value;
var newdate=new Date(temp_year,temp_month);
var datenum=newdate.getUTCDate();
tarobj.length = datenum;