jquery时间日期三级联动

  <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

  <!DOCTYPE html>

  <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="js/jquery-1.7.2.min.js"></script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="dr_year" runat="server"></asp:DropDownList>年
<asp:DropDownList ID="dr_month" runat="server"></asp:DropDownList>月
<asp:DropDownList ID="dr_day" runat="server"></asp:DropDownList>日
</div>
</form>
</body>
</html>
<script>
var days = ;
years();
months();
Days();
var date = new Date();
$("#dr_year").val(date.getFullYear());
$("#dr_month").val((date.getMonth() + ));
$("#dr_day").val(date.getDate());
$("#dr_year").change(function () {
months();
Days();
}); $("#dr_month").change(function () {
Days();
});
function years()
{
for(var i=;i<=;i++)
{
var str = "<option value=\"" + i + "\">" + i+ "</option>";
$("#dr_year").append(str);
}
}
function months() {
$("#dr_month").empty();
for (var i = ; i <= ; i++) {
var str = "<option value=\"" + i + "\">" + i + "</option>";
$("#dr_month").append(str);
}
}
function Days() {
$("#dr_day").empty();
if (parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == ) {
days = ;
}
else if (parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == || parseInt($("#dr_month").val()) == ) {
days = ;
}
else {
if (parseInt($("#dr_year").val()) % == || (parseInt($("#dr_year").val()) % == && parseInt($("#dr_year").val()) % != )) {
days = ;
}
else {
days = ;
}
}
for (var i = ; i <= days; i++) {
var str = "<option value=\"" + i + "\">" + i + "</option>";
$("#dr_day").append(str);
}
}
</script>
上一篇:Webform 文件上传、 C#加图片水印 、 图片验证码


下一篇:Android Studio 插件开发详解四:填坑