function toDate(){
with(document.all){
vYear=parseInt(year.options[year.selectedIndex].text)
vMonth=parseInt(month.options[month.selectedIndex].text)
day.length=0;
for(i=0;i<(new Date(vYear,vMonth,0)).getDate();i++){day.options[day.length++].value=day.length;day.options[day.length-1].text=day.length;}
}
toDay();
}function toDay(){
vDay=parseInt(document.all.day.options[document.all.day.selectedIndex].value)
document.all("weekday").value="星期"+arr[new Date(vYear,vMonth-1,vDay).getDay()]
}
with(document.all){
vYear=parseInt(year.options[year.selectedIndex].text)
vMonth=parseInt(month.options[month.selectedIndex].text)
day.length=0;
for(i=0;i<(new Date(vYear,vMonth,0)).getDate();i++){day.options[day.length++].value=day.length;day.options[day.length-1].text=day.length;}
}
toDay();
}function toDay(){
vDay=parseInt(document.all.day.options[document.all.day.selectedIndex].value)
document.all("weekday").value="星期"+arr[new Date(vYear,vMonth-1,vDay).getDay()]
}
<p><font color=red><%=user%></font>的加班记录!<br>
<br>
加班日期:
<select id=year onChange=toDate() name="year" class=smallInput >
<script>for(i=2004;i<=2004;i++)document.write("<option>"+i+"</option>")</script>
</select>
<select id=month onChange=toDate() name="month" class=smallInput >
<script>for(i=1;i<=12;i++)document.write("<option>"+i+"</option>")</script>
</select>
<select id=day onChange=toDay() name="day" class=smallInput>
</select>
<input name=weekday size="10" class=smallInput >
<script>
var arr="日一二三四五六".split("")
给你全点吧
这是我自己写的,下拉框选年月日自动显示星期
不过是jsp的
js的应该是一样的