You are here: irt.org | FAQ | JavaScript | Form | Q1728 [ previous next ]
try:
<html> <body> <form> <script language="JavaScript"><!-- var now = new Date() var aDay = 24*60*60*1000; var then = new Date(now.getTime()-(14*aDay)); var text = '<select>'; for (i=then.getTime();i<now.getTime();i+=aDay) { var date = new Date(i); var year = date.getYear(); if (year < 1900) year += 1900; var dateString = (date.getMonth()+1)+'/'+date.getDate()+'/'+year; text += '\n<option value="' + dateString + '">'+ dateString+'</option>'; } text += '</select>'; document.write(text); //--></script> </form> </body> </html>