<% @ Page Language = "VB" autoeventwireup = "false" codefile = "default. aspx. VB" inherits = "_ default" %>
<! 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 runat = "server">
<Title> No title page </title>
<Script language = "JavaScript" type = "text/JavaScript" src = "my97datepicker/wdatepicker. js"> </SCRIPT>
</Head>
<Script language = "JavaScript" type = "text/JavaScript">
Function adddaybydate (Form, num)
{
If (Form. value! = '')
{
VaR strdate = form. value;
VaR B = strdate. Split ("-");
VaR month = parseint (B [1]);
VaR year = parseint (B [0]);
VaR day = parseint (B [2]);
VaR num = parseint (Num );
VaR check4 = (0 = year % 4); // determines whether the year can be divisible by 4
VaR check100 = (0 = year % 100); // determines whether the year can be divisible by 100
VaR check400 = (0 = year % 400); // determines whether the year can be divisible by 400
If (check4 &&! Check100) | check400)
{
If (month = 2)
{
If (day + num> 29)
{
Month = month + 1;
Day = day + num-29;
}
Else
{
Day = day + num;
}
}
}
Else
{
If (month = 2)
{
If (day + num> 28)
{
Month = month + 1;
Day = day + num-28;
}
Else
{
Day = day + num;
}
}
}
If (month = 1 | month = 3 | month = 5 | month = 7 | month = 8 | month = 10 | month = = 12)
{
If (day + num> 31)
{
Month = month + 1;
If (month> 12)
{
Month = 1;
Year ++;
}
Day = day + num-31;
}
Else
{
Day = day + num;
}
}
If (month = 4 | month = 6 | month = 9 | month = 11)
{
If (day + num> 30)
{
Month = month + 1;
Day = day + num-30;
}
Else
{
Day = day + num;
}
}
If (month <10)
Month = "0" + month;
If (day <10)
Day = "0" + Day;
Strdate = year + "-" + month + "-" + Day;
Document.all.txt output. value = strdate;
}
}
</SCRIPT>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: textbox id = "txtoutput" runat = "server"/>
<Asp: textbox id = "txtinput" runat = "server" onfocus = "New wdatepicker (this, '% Y-% m-% d', false ); "onpropertychange =" adddaybydate (this, '2'); "> </ASP: textbox>
</Div>
</Form>
</Body>
</Html>