Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


JavaScript Calendar Popup

Posted on 2009-02-10
Medium Priority
Last Modified: 2013-11-19

I have been working on a event form for a colleague of mine that the company I work for will be hosting.  I have managed with the assistance of experts here at expert-exchange to get the form working with a fair bit of JavaScript, however I have noticed a slight issue with some script I found on the Internet which provides a JavaScript popup calendar which opens in a div.  The calendar works fine and looks great and does exactly what I want it to do.

The problem is one of my fields is date of birth and the calendar only starts from 2007 and ends at 2011.  I have looked at the JavaScript and found some reference to the start year offset and changes it from 2 to 120.  The issue with this is it displays 120 years  + and - of the current year.  This is no good for me all I wanted it to do is go back 120 years and remain 2 years + of the current year.

I have uploaded the JavaScript file and was wondering if there is anything I missing.  I would really appreciate any assistance with this as it's the last little issue I have.
Question by:john_hollings
LVL 16

Accepted Solution

Robin earned 2000 total points
ID: 23599508
If you want that functionality in that attached javascript file, please change line #1289
which contains:

for( var yearCounter=year-this.yearSelectStartOffset; yearCounter<=year+this.yearSelectStartOffset; yearCounter++ ) {


for( var yearCounter=year-this.yearSelectStartOffset; yearCounter<=year; yearCounter++ ) {

and it will only show the years from the current year until the current year minus the offset.

Author Closing Comment

ID: 31544925
Nice one, it works - thank you so much, I have been looking at this JS code for days trying to find where it applied the yearCounter.  My knowledge of JavaScript is very limited but is growing all the time thanks to you and the other experts here that keep helping.  So again many thanks for your help.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question