
Nov 11th, 2004, 19:44
|
 |
Guest
|
|
|
|
see if this helps:
- Code: Select all
<select>
<script language="javascript" type="text/javascript">
<!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
thisdate = day;
for (i=0;i<7;i++) {
switch(month)
{
case 1,3,5,7,8,10:
if (thisdate > 30) {
thisdate = 1;
day = 1 - i;
month = month + 1;
}
else
{
thisdate = day + i;
}
break;
case 4,6,9,11:
if (thisdate > 29) {
thisdate = 1;
day = 1 - i;
month = month + 1;
}
else
{
thisdate = day + i;
}
break;
case 12:
if (thisdate > 30) {
thisdate = 1;
day = 1 - i;
month = 1;
year = year + 1;
}
else
{
thisdate = day + i;
}
break;
case 2:
if (thisdate > 27) {
thisdate = 1;
day = 1 - i;
month = month + 1;
}
else
{
thisdate = day + i;
}
break;
}
document.write("<option>" + thisdate + "/" + month + "/" + year + "</option>");
}
//-->
</script>
</select>
|