There is nothing in this code. I want to hide the key points in the Code and find them!
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> show date </title>
<Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
Name = "mark ";
Function showLastDate ()
{
Alert (name );
Var reg =/^ \ d {4} \/\ d {1, 2} \/\ d {1, 2} $ /;
Var inputdate = $ ("# indate"). val ();
If (! Reg. test (inputdate ))
{
Alert ("please input date like: 2013/1/14 ");
Return;
}
Var month = parseInt (inputdate. split ("/") [1]);
If (month> 12 | month = 0)
{
Alert ("please input month range from 1-12 ");
Return;
}
Var showdate = getLastDate (inputdate );
$ ("# Lastdate"). val (showdate );
}
Function getLastDate (indate)
{
Alert (name );
Var year = parseInt (indate. split ("/") [0]);
Var month = parseInt (indate. split ("/") [1]);
// Run nian
Var isrun = false;
If (year % 4 = 0 & amp; year % 100! = 0) | year % 400 = 0)
Isrun = true;
Switch (month)
{
Case 2:
If (isrun)
{Return 29 ;}
Else
{Return 28 ;}
Case 1:
Case 3:
Case 5:
Case 7:
Case 8:
Case 10:
Case 12:
Return 31;
Default:
Return 30;
}
}
</Script>
</Head>
<Body style = "margin-left: 100px; margin-top: 20px;">
<Br>
Input date: <input id = "indate" type = "text"/> example: 2013/1/14 <br>
<Input type = "button" onclick = "showLastDate ()" value = "Get Last Date"/> <br>
Input date: <input id = "lastdate" type = "text"/> <br>
</Body>
</Html>