<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<script language= "JavaScript" >
function Fun () {
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];
Give the contents of the under Decade frame first
var y = new Date (). getFullYear ();
var str = stryyyy.substring (0, stryyyy.length-9);
for (var i = (y-30); i < (y +); i++)//Based on this year, first 30 years, 30 years after
{
str + = "<option value=" + i + ">" + i + "year" + "</option>\r\n";
}
Document.form1.YYYY.outerHTML = str + "</select>";
Assign month drop-down box
var str = strmm.substring (0, strmm.length-9);
for (var i = 1; i < 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); Assign Date drop-down box
Document.form1.DD.value = new Date (). GetDate ();
}
Window.onload=fun;
function Yyyymm (str)//Change date change (mainly to judge the leap common year)
{
var mmvalue = Document.form1.mm.options[document.form1.mm.selectedindex].value;
if (Mmvalue = = "") {dd.outerhtml = Strdd; Return }
var n = monhead[mmvalue-1];
if (Mmvalue = = 2 && ispinyear (str)) n++;
Writeday (N)
}
Date linkage when function MMDD (str)//month is changed
{
var yyyyvalue = Document.form1.yyyy.options[document.form1.yyyy.selectedindex].value;
if (str = = "") {dd.outerhtml = Strdd; Return }
var n = monhead[str-1];
if (str = = 2 && ispinyear (yyyyvalue)) n++;
Writeday (N)
}
function Writeday (n)//drop-down box based on conditional write 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)//judge whether the leap common year
{
return (0 = = year% 4 && (year%!! = 0 | | year% 400 = = 0))
}
</script>
<body onload= "Fun ()" >
<form id= "Form1" Name= "Form1" action= "" >
<div>
<select name= "YYYY" onchange= "Yyyymm (this.value)" >
<option value= "" > Please select year </option>
</select>
<select name= "MM" onchange= "MMDD (this.value)" >
<option value= "" > select month </option>
</select>
<select name= "DD" >
<option value= "" > Select Day </option>
</select>
</div>
</form>
</body>