ASP. My97 Date Picker When you set the default start time to n years ago today

Source: Internet
Author: User

You can use the My97 date picker component to collect date values entered by the user.

First download the component: Http://www.my97.net/dp/index.asp into your project.

Then reference the JS and CSS files inside the project, for example:

 <  script  language  = "JavaScript"   type  = "Text/javascript"   src  = "./my97datepicker/wdatepicker.js"  ></ script  >  <  link  href  = "./my97datepicker/skin/wdatepicker.css"   rel  = "Stylesheet"   type  = "Text/css"  />  

Of course, the directory should be written right.

Then add a text box to the page:

<class= "wdate"  type= "text"  onclick= " Wdatepicker () "  ID=" Htmltxtbirthday "  runat=" Server "  readonly  = "readonly"/>

You can use an ASP. NET TextBox or an HTML text box.

However, the default starting date for this component is the current date of the client. Sometimes you need to enter the data is a birthday, if the start date is the current date, it is necessary to click several times to find the appropriate date, a little trouble.

See the documentation on the official website and find a solution:

But from this point of view, it seems not flexible enough. For example, sometimes we expect users to be about 16 years old, so consider pushing forward 15 or 16 as the starting date with the current date.

<class= "wdate"  type= "text"  onclick= "Dt=new Date (); Y=dt.getfullyear () -15;dt2= y.tostring () + '-' + (Dt.getmonth () +1) + '-' +dt.getdate (); Wdatepicker ({startdate:dt2}) "  ID=" Htmltxtbirthday "  runat=" Server "  readonly=" readonly "/>                        

The starting date for this place is 15 years ago today. However, if today is a leap year February 29, 15 years ago without February 29, it may be wrong. It is therefore possible to consider the starting date of New Year's Day, 15 years ago.

<class= "wdate"  type= "text"  onclick= "Dt=new Date (); Y=dt.getfullyear () -15;dt2= y.tostring () + '-' + 1 + '-' +1; Wdatepicker ({startdate:dt2}) "  ID=" Htmltxtbirthday "  runat=" Server "  readonly=" readonly "/>                        

ASP. My97 Date Picker When you set the default start time to n years ago today

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.