如何实现年月日的三级联动,

wql_8302 2005-12-27 09:40:27
在asp中如何实现年月日的三级联动,要求:如选择2月不能有31天,谢谢
...全文
128 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
KimSoft 2005-12-28
  • 打赏
  • 举报
回复
<form>
<select id=year onchange=toDate()>
<script>for(i=1970;i<=2010;i++)document.write("<option>"+i+"</option>")</script>
</select>
<select id=month onchange=toDate()>
<script>for(i=1;i<=12;i++)document.write("<option>"+i+"</option>")</script>
</select>
<select id=day onchange=toDay()></select>
<input name=weekday>
</form>
<script>
var arr="日一二三四五六".split("")

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()]
}

window.onload=toDate;
</script>
创造奇迹9999 2005-12-28
  • 打赏
  • 举报
回复
UP
singlepine 2005-12-28
  • 打赏
  • 举报
回复
http://singlepine.cnblogs.com/articles/266334.html
wql_8302 2005-12-27
  • 打赏
  • 举报
回复
只要在asp中能用就行,谢谢了
  • 打赏
  • 举报
回复
我写过一个dotnet版的你要不?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧