iPixel Posted December 29, 2008 Share Posted December 29, 2008 What i'm looking to do is have 6 drop downs, Day1 [ V] Month1 [ V] Year1 [ V] Day2 [ V] Month2 [ V] Year2 [ V] and what i want is to use javascript to fill in all the fields where Day1Month1Year1 = to current date and Day2Month2Year2 = current date + 3 days. Any tips are really welcomed THANKS in advance. Link to comment https://forums.phpfreaks.com/topic/138788-populate-dropdowns-with-date/ Share on other sites More sharing options...
iPixel Posted December 30, 2008 Author Share Posted December 30, 2008 Ok i got it working, but it's not friendly to IE6... any ideas why. <script language="javascript"> function initdt() { var t = new Date; document.DateSelect.fd.value = t.getDate(); document.DateSelect.fm.value = t.getMonth() + 1; document.DateSelect.td.value = t.getDate() + 3; if(t.getMonth() + 1 == 12) { document.DateSelect.tm.value = t.getMonth() - 10; } else { document.DateSelect.tm.value = t.getMonth() + 1; } } </script> The Day dropdown does not get selected at all in IE6 but works just fine in FF for the second date dropdown day. I know it has something to do with the whole 29+3 does not equal 1 in IE6 but how do i get over that, FF is aparently smart enough to figure out it's 29/30/31/1 as opposed to 32 Link to comment https://forums.phpfreaks.com/topic/138788-populate-dropdowns-with-date/#findComment-725897 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.