The JavaScript Date Picker

Such a widget provides a couple of nice features. First of all, it helps you make sure the application gets good data. While it’s quite easy for the user to mistype a date, a correctly built script can place a correctly formatted date in your field 100% of the time.
This tutorial builds the Date Picker in JavaScript. You can cut and paste the code into your own appliciations.
Table of Content:
- How it looks
- How it functions
- Setup: HTML and CSS
- Setting up the script
- The main script
- FormatDate()
- Next and Previous
- The First Day
- Calendar Header
- FormatRawDate()
- Build the Calendar
- Closing it up
- The SelectDate() Function
- Full Script Listing
- Conclusion
- Coda
Tom Dell'Aringa
Tom got his start in web development in the winter of 1995 when his boss threw an HTML book in his direction stating "we should learn about this world wide web thing." Since then he has worked at dot.com era start-ups with no real business model, web integrator Scient, and as a freelance and contracting developer. He is currently an Interaction Designer for ServiceMaster.
Experienced in HTML, JavaScript, and CSS as well as server-side scripting languages, he has worked on everything from simple brochure sites to enterprise level portals.
It was during one of these large projects that he finally got fed up with the "IE only" mentality of coding. Additionally, even large corporations seemed unaware of the benefits of separating style from content and still produced bloated, non-standard code. In response to this, and a corresponding discussion on Evolt's thelist (http://evolt.org), he founded MACCAWS (http://www.MACCAWS.org) in late 2002.
Lately part of his role on teams involves explaining to developers what LABEL tags are, that they shouldn't build layouts with tables nested ten levels deep, showing them alternatives to using 127 spacer gifs per page, proving the benefits of a global stylesheet and defining DOCTYPEs and how to use them.
He realized the dot.com era was over when his paychecks started bouncing right after the big welcome party he had been flown to in San Francisco. He currently resides in the Midwest with his wife and two children. He plays guitar and even recorded a demo CD with his band(http://www.garageband.com/artist/thestand). Constantly scouring Ebay and garage sales for Charlie Brown and Snoopy paperbacks, he is finding it very hard to find the Peanuts Parade versions...anyone..?








