Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1649 How can I show the next seven days in a drop down list?

irt.org | Knowledge Base | JavaScript | Date | Q1649 [ previous next ]

Q1649 How can I show the next seven days in a drop down list?

Try:

<script language="JavaScript"><!--
var now = new Date();
now = new Date(now.getFullYear(),now.getMonth(),now.getDate(),0,0,0); // midnight

var text = '<form><select>';
for (i=0; i<7; i++) {
   var theDay = new Date(now.getTime()+(i*24*60*60*1000));
   text += '\n<option> ' + theDay.getFullYear() + '/' + (theDay.getMonth()+1) + '/' + theDay.getDate();
}
text += '</select></form>';
document.write(text);
//--></script>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.