The world's Gregorian (solar calendar) now has a long -term evolution process. Let's see first, the number of days per month for the Gregorian calendar is fixed: "The seven front is large, and the eight after the eight."也就是说,一、三、五、七、八、十、腊月(十二月)是31天,四、六、九、十一月是30天,只有二月,平年28天,闰年29天Essence
Copy code code as follows:
< %@Page Language = "C#" AutoeEventwireup = "True" Codebehind = "Webform1.aspx.cs" Inherits = "Webapplication1.webform1" %>
<! Doctype HTML PUBLIC "-// W3C // DTD XHTML 1.0 Transitional // EN" http://www.w3.org/xhtml1/dtddml1-transitationAl.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head runat = "server">
<Title> </title>
</head>
<body>
<found id = "form1" runat = "server">
<div>
<select name = yyyy id = "yyyy" onchange = "yyyymm (this.value)">
<option value = ""> Select the year </option>
</select>
<select name = mm ID = "mm" onchange = "mmdd (this.value)">>
<option value = ""> Select Moon </option>
</select>
<select name = dd ID = "dd">
<option value = ""> Select Day </option>
</select>
</div>
<asp: hiddenfield id = "hfvalue" runat = "server" />
<asp: Button ID = "BTNSAVE" Runat = "Server" text = "Save" OnClick = "BTNSAVE_CLICK" />
</form>
</body>
</html>
<script language = "javascript">
<!--
function getValue () {
var Year = document.GetelementByid ("yyyy"). Options [document.GetelementByid ("yyyy"). SelectedInDex]. Value;
varmedh = document.GetelementByid ("mm").
var day = document.GetelementByid ("DD").
document.GetelementByid ("hfvalue"). Value = year+"-"+month+"-"+day;
}
window.onload = function () {
Stryyyy = document.form1.yyyy.outerhtml;
strmm = document.form1.mm.outerhtml;
strdd = document.form1.dd.outerhtml;
Monhead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Let's give the content of the year of the year.
var y y = new date (). getfullyear ();
var str = Stryyyyy.substring (0, Stryyyyyyyyyy -Length -9);
for (var I = (y -80); i <(y+2); i ++) // This year's prevailing, the first 30 years, the next 30 years
{{
str + = "<option value = '" + I + "'>" + I + "year" + "</option>/r/n";
}
document.form1.yyyy.outerhtml = str + "</select>" ";
// The drop -down box of Fuyue
var str = strmm.substring (0, strmm.length -9);
for (var I = 1; i <13; i ++) {
str + = "<option value = '" + i + "'>" + i + "month" + "</option>/r/n";
}
document.form1.mm.outerhtml = str + "</select>" ";
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); // Date down drop box
document.form1.dd.value = new date (). Getdate ();
}
Function yyyymm (STR) // The date changes when the year changes (mainly judging the year of the Ping Ping)
{{
var mmvalue = document.form1.mm.option
if (mmvalue == "") {{
Dd.outerhtml = strdd;
Return;
}
var n = monhead [mmvalue - 1];
if (mmvalue == 2 && ispinyear (str)) n ++;
Writeday (n)
}
Function mmdd (STR) // Monthly changing date link
{{
varyyyvalue = document.form1.yyyy.options [document.form1.yyyy.selectEdex]. Value;
if (str == "") {
Dd.outerhtml = strdd;
Return;
}
var n = monhead [str -1];
if (str == 2 && ispinyear (yyyyvalue) n ++;
Writeday (n)
}
Function WRITEDAY (n) // The drop -down box of the date of writing date
{{
var s = strdd.substring (0, strdd.length -9);
for (var I = 1; i <(n + 1); i ++) s + = "<option value = '" + i + "'>" + i + "day" +
"</option>/r/n";
document.form1.dd.outerhtml = s + "</select>" ";
}
Function iSpinyear (year) // Judging whether to flatten the year
{{
Return (0 == Year % 4 && (year % 100! = 0 || Year % 400 == 0))
}
//->
</script>
.aspx.cs
Copy code code as follows:
using system;
using system.Collections.gneric;
using system.linq;
using system.web;
using system.web.ui;
using system.web.ui.webcontrols;
namespace webapplication1
{{
public partial class webform1: system.web.ui.page
{{
Protected void Page_Load (Object Sender, EventArgs E)
{{
btnsave.attributes.add ("OnClick", "Getvalue ()");
}
Protected void void btnsave_click (Object Sender, EventArgs E)
{{
Response.write (hfvalue.value);
}
}
}