Avivit,
Thanks for the reply - as you've discovered, apparently Netscape has some
sort of y2k bug, where it will return 101 for the year 2001.
If you're interested, this revised version of the code works in both IE
and Netscape :
------------------------------------------------------
BEGINNING OF CODE SNIPPET ...
------------------------------------------------------
<SCRIPT LANGUAGE="JavaScript">
function display_year_combo()
{
var thisYear, i
// get current date
date=new Date()
// year 2000 problem in old versions of netscape
// (Netscape returns 101 for the year 2001)
if(date.getYear()<1000)
{
thisYear = date.getYear() + 1900;
} else {
thisYear = date.getYear();
}
// write beginning of year-combo
document.write('<select name=\"cboFormYear\">')
// loop through each year
for(i=1970;i<=thisYear;i++) {
document.write('<option value=\"' + i + '\">' + i
+'</option>')
}
// write end of year-combo
document.write('</select>')
}
</SCRIPT>
..... Then the code for the HTML form looks like ....
<TR>
<TD><FONT face=Verdana size=2>Select A Year</FONT></TD>
<TD><FONT face=Verdana size=2>
<SCRIPT language="JavaScript">
display_year_combo();
</SCRIPT>
</FONT></TD>
</TR>
------------------------------------------------------
END OF CODE SNIPPET ...
------------------------------------------------------
Thanks are owed to Arjan Bosboom, who helped me out on this problem.
Ray
> Add <form> start/end tags, And replace date.getYear with date.getFullYear
()
> (form tag are A must for netscape.)
> (Alert the date.getYear() in netscape and Ie.
> When I tried, I got "101" in netscape, and "2001" in IE (as should)!!!
> In netscape case, the loop never took place. Replace it with getFullYear
())