下拉框选择年月日代码下载

weixin_39822095 weixin_39822095 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<HTML>
<HEAD>
<title>年月日三联动下拉框</title>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<meta name='author' content='http://singlepine.cnblogs.com/'>
</HEAD>
<body>
<form name="form1"&g
相关下载链接://download.csdn.net/download/a821808/4262275?utm_source=bbsseo
...全文

相关推荐

JS年月日三级联动下拉框日期选择特效代码

JS年月日三级联动下拉框日期选择代码,默认当前日期,代码附带详细中文注释,供大家参考。

weixin_38715008

jQeruy年月日选择三级联动

使用标签创建选择年月日下拉框

weixin_38701640

JS年月日联动下拉框[代码]

该文章介绍了一个使用JavaScript实现的年、月、日三级联动下拉框功能。通过初始化当前日期并动态填充下拉选项,实现了根据年份和月份变化自动调整日期选项的功能。代码中包含了判断闰年的逻辑,确保2月份的天数正确显示。整体实现简洁高效,适合需要日期选择的Web应用场景。

http9protocoller

纯JS封装YMDClass年月日三级联动插件

纯JS封装YMDClass年月日三级联动插件

weixin_38514501

下拉框选择年月日代码

&lt;HTML&gt; &lt;HEAD&gt; &lt;title&gt;年月日三联动下拉框&lt;/title&gt; &lt;meta http-equiv='Content-Type' content='text/html; charset=gb2312'&gt; &lt;meta name='author' content='http://singlepine.cnblogs.com/'&gt; &lt;/HEAD&gt; &lt;body&gt; &lt;form name="form1"&gt; 请选择 年 选择 月 选择 日 &lt;/form&gt; [removed]&lt;!-- function YYYYMMDDstart() { MonHead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; //先给年下拉框赋内容 var y = new Date().getFullYear(); for (var i = (y-30); i < (y+30); i++) //以今年为准,前30年,后30年 document.form1.YYYY.options.add(new Option(" "+ i +" 年", i)); //赋月份的下拉框 for (var i = 1; i < 13; i++) document.form1.MM.options.add(new Option(" " + i + " 月", i)); document.form1.YYYY.value = y; document.form1.MM.value = new Date().getMonth() + 1; var n = MonHead[new Date().getMonth()]; if (new Date().getMonth() ==1 && IsPinYear(YYYYvalue)) n++; writeDay(n); //赋日期下拉框 document.form1.DD.value = new Date().getDate(); } if(document.attachEvent) window.attachEvent("onload", YYYYMMDDstart); else window.addEventListener('load', YYYYMMDDstart, false); function YYYYDD(str) //年发生变化时日期发生变化(主要是判断闰平年) { var MMvalue = document.form1.MM.options[document.form1.MM.selectedIndex].value; if (MMvalue == ""){ var e = document.form1.DD; optionsClear(e); return;} var n = MonHead[MMvalue - 1]; if (MMvalue ==2 && IsPinYear(str)) n++; writeDay(n) } function MMDD(str) //月发生变化时日期联动 { var YYYYvalue = document.form1.YYYY.options[document.form1.YYYY.selectedIndex].value; if (YYYYvalue == ""){ var e = document.form1.DD; optionsClear(e); return;} var n = MonHead[str - 1]; if (str ==2 && IsPinYear(YYYYvalue)) n++; writeDay(n) } function writeDay(n) //据条件写日期的下拉框 { var e = document.form1.DD; optionsClear(e); for (var i=1; i<(n+1); i++) e.options.add(new Option(" "+ i + " 日", i)); } function IsPinYear(year)//判断是否闰平年 { return(0 == year%4 && (year0 !=0 || year@0 == 0)); } function optionsClear(e) { e.options.length = 1; } //--&gt; [removed] &lt;/body&gt; &lt;/HTML&gt;

a821808
评论
收藏 已收藏
分享
返回顶部