Script Categories

Forms >>> Auto Year.

This pulldown menu will automatically adjust the range of years depending on the current year. As an added bonus, the range is easily modified.

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var time = new Date();
var year = time.getYear();
if (year < 1900) {
year = year + 1900;
var date = year - 101; /*change the '101' to the number of years in the past you want to show */
var future = year + 100; /*change the '100' to the number of years in the future you want to show */
document.writeln ("<FORM><SELECT><OPTION value=\"\">Year");
do {
document.write ("<OPTION value=\"" +date+"\">" +date+ "");
while (date < future)
document.write ("</SELECT></FORM>");
//  End -->

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).