<script type="text/javascript">
function MonthOfDay()
{
var year=document.getElementById("Tb_year").value;
if(year.length!=4)
{
alert('请输入正确的年份!');
return;
}
if(isNaN(year)==true)
{
alert('年份必须为数字');
return;
}
var month=document.getElementById("Tb_month").value;
if(month>12 || month<=0)
{
alert('请输入正确的月份!');
return;
}
if(isNaN(month)==true)
{
alert('月份必须为数字');
return;
}
if((year!="")&&(month!=""))
{
switch(month)
{
case '1':
case '3':
case '5':
case '7':
case '9':
case '10':
document.getElementById("Tb_Day").value=31;
break;
case '4':
case '6':
case '8':
case '11':
case '12':
document.getElementById("Tb_Day").value=30;
break;
case '2':
if((year%4==0)&&(year%100!=0)||(year%400==0))
{
document.getElementById("Tb_Day").value=29;
}
else
{
document.getElementById("Tb_Day").value=28;
}
break;
default:
break;
};
}
else
{
alert('请输入要查询的年份或月份!');
}
}
</script>