473,396 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need to change year

155 100+
Hey,

I have this code that displays a default year and and from a drop down menu 15 additional years from the default year.

The default year is 2000. I'd like to change it to the current year (2008) if it's possible and the fifteen additional years start from 2008.

Thanks.

[PHP] output += '</select> \n<select id="year">\n';
for(var i=0;i<=15;i++) {
n = (i<10)? '0'+i:i;
output += '<option value="20'+n+'">20'+n+' </option>\n';
}
output += '</select> <a href="javascript:jumpTo()"><img src="/calendar/images/calGo.gif" alt="go" />Go</a> <a href="javascript:hideJump()"><img src="/calendar/images/calStop.gif" alt="close" />Close</a>';
jump.innerHTML = output;
document.body.appendChild(jump);
}
[/PHP]
Feb 25 '08 #1
2 1304
DavidPr
155 100+
OK got it.

[PHP]output += '</select> \n<select id="year">\n';
for(var i=8;i<=23;i++) {
n = (i<10)? '0'+i:i;
output += '<option value="20'+n+'">20'+n+' </option>\n';
}
output += '</select> <a href="javascript:jumpTo()"><img src="/calendar/images/calGo.gif" alt="go" />Go</a> <a href="javascript:hideJump()"><img src="/calendar/images/calStop.gif" alt="close" />Close</a>';
jump.innerHTML = output;
document.body.appendChild(jump);
}[/PHP]
Thanks
Feb 26 '08 #2
acoder
16,027 Expert Mod 8TB
Instead of that, get the current year automatically, so you don't have to keep changing the code each year.
Feb 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Keyed4U | last post by:
I have a drop down list system (works to some extent) for a date range search that I need to do a little more. The following is a small sample from the script: function modify_mo_list(mo_model)...
8
by: Shlomi Schwartz | last post by:
Hi all, Why do I get the folowing date when creating it like so: var d = new Date(2003,9,2); Wed Oct 1 23:00:00 UTC+0200 2003 Isent it soposed to be:
2
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server...
3
by: charliewest | last post by:
Can someone recommend a fairly easy to use ASP.NET custom calendar control that makes it easy for the user to select the month and year - versus the inherent "paging" that is used in the default...
3
by: mistral | last post by:
Here is javscript clock: http://javascript.internet.com/time-date/mousetrailclock.html which I want adjust a little: 1. I want replace the days of week/year/date in external circle with just...
10
by: OldBirdman | last post by:
On a Report, can I change any of the fields in the "Sorting and Grouping Dialog" from within Visual Basic??? Changing the OrderBy property of the Report doesn't change anything, nor does adding an...
2
by: jonathan184 | last post by:
Hi basically what i want this script to do is In a particular dir there are alot of files from today back to 1999 or earlier. So I am trying to have the script search this dir and sort the files...
15
by: rhino | last post by:
I've put together a prototype of two-tiered CSS tabs that works really well in IE6, IE7, and FF2. It also works very well in Opera 9.27 _except_ that the placement of the lower tier of tabs is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.