JS时间下拉菜单

精贴 置顶
3731 0

/////////////////////////////////////////////////////
//////
// 函数说明:年份下拉列表生成函数 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

  • 没有任何评论
今日天气 ···

···

···

···

热门排行
用ASP实现网页BBS 2010-11-01
CSS cursor鼠标样式一览表 2012-06-25
.NET后台写JS代码 2011-11-03
网站地址多出jdfwkey的问题解析及... 2010-08-25
数据库xxx的日志已满,请备份该数... 2013-07-19
百度、google、Yahoo网站地图制作... 2011-01-30
<a>标签的伪类书写顺序问题... 2010-09-04
什么是长尾关键词? 2010-09-24
CEO名言 2010-08-31
Mysql 主从数据库同步 2010-09-12
博主推荐
本个人博客微信公众平台上线啦~~... 2013-10-13
饼哥网络互联上线啦~~要买域名空... 2013-09-20
网站title标题如何正确修改不会被... 2013-08-26
饼哥通讯录系统上线啦,欢迎大家... 2013-08-24
ASP .NET MYSQL 的简单分页 并不... 2013-08-19
网站有弹窗广告这样的站点,百度... 2013-08-17
做淘宝SEO优化需要注意的8大问题 2013-08-17
淘宝网怎么做SEO优化 2013-08-17
站长们要学习的“苍井空精神” 2013-08-17
苹果公司今日发布了iOS 7第五个开... 2013-08-07
随便看看
教大家自己做一个QQ强行聊天器! 2010-09-07
ASP.NET跨页面传值技巧总结 2010-09-10
网页中添加QQ号留言和阿里旺旺 2013-10-06
怎么看关键词优化得好不好? 2010-09-19
Google网站流量统计 2010-09-26
ASP用Base64加解密 2013-06-01
Asp.Net 加密解密 2013-11-02
404页面该怎么做? 2010-09-18
在服务器端控制网页 2010-11-01
创建文本形式的Sitemap 2010-09-26
RSS新闻
传媒新闻
CSDN
八卦新闻
女性新闻
台湾新闻
互联网
军事-新浪博客
IT-新浪博客
汽车新闻
游戏新闻
国际新闻
国内新闻
体育新闻
我的微博
北京 上海 杭州 深圳 广州 成都