日期判断出错,求高手修改代码
<html>
<head>
<title>年月日</title>
</head>
<body>
<SCRIPT language=javascript>
function checkit(){
if(document.form1.col_month_1.value==2 && document.form1.col_day_1.value>29){
alert("请选择正确的日期!");
document.form1.col_day_1.focus();
return false;
}
if(document.form1.col_month_1.value==4 && document.form1.col_day_1.value>30){
alert("请选择正确的日期!");
document.form1.col_day_1.focus();
return false;
}
if(document.form1.col_month_1.value==6 && document.form1.col_day_1.value>30){
alert("请选择正确的日期!");
document.form1.col_day_1.focus();
return false;
}
if(document.form1.col_month_1.value==9 && document.form1.col_day_1.value>30){
alert("请选择正确的日期!");
document.form1.col_day_1.focus();
return false;
}
if(document.form1.col_month_1.value==11 && document.form1.col_day_1.value>30){
alert("请选择正确的日期!");
document.form1.col_day_1.focus();
return false;
}
if(document.form1.col_month_2.value==2 && document.form1.col_day_2.value>29){
alert("请选择正确的日期!");
document.form1.col_day_2.focus();
return false;
}
if(document.form1.col_month_2.value==4 && document.form1.col_day_2.value>30){
alert("请选择正确的日期!");
document.form1.col_day_2.focus();
return false;
}
if(document.form1.col_month_2.value==6 && document.form1.col_day_2.value>30){
alert("请选择正确的日期!");
document.form1.col_day_2.focus();
return false;
}
if(document.form1.col_month_2.value==9 && document.form1.col_day_2.value>30){
alert("请选择正确的日期!");
document.form1.col_day_2.focus();
return false;
}
if(document.form1.col_month_2.value==11 && document.form1.col_day_2.value>30){
alert("请选择正确的日期!");
document.form1.col_day_2.focus();
return false;
}
if(document.form1.col_year_1.value > document.form1.col_year_2.value){
alert("请选择正确年份!");
document.form1.col_year_2.focus();
return false;
}
if(document.form1.col_year_1.value == document.form1.col_year_2.value && document.form1.col_month_1.value > document.form1.col_month_2.value){
alert("请选择正确月份!");
document.form1.col_month_2.focus();
return false;
}
if(document.form1.col_year_1.value == document.form1.col_year_2.value){
if(document.form1.col_month_1.value == document.form1.col_month_2.value && document.form1.col_day_1.value > document.form1.col_day_2.value){
alert("请选择正确日期!");
document.form1.col_day_2.focus();
return false;
}
}
}
</SCRIPT>
<form name="form1" method="post" action="" enctype="" onSubmit="return checkit();">
<input type="hidden" name="flag" value="save">
时间:
<p><select name="col_year_1">
<%
for x = 2006 to 2020
Response.Write("<option value="&x&" ")
if col_year_1 <> "" then
if x = CInt(col_year_1) then
Response.Write("selected")
end if
else
if x = year(now()) then
Response.Write("selected")
end if
end if
Response.Write(">"&x&"</option>")
next
%>
</select>年
<select name="col_month_1">
<%
for x = 1 to 12
Response.Write("<option value="&x&" ")
if col_month_1 <> "" then
if x = CInt(col_month_1) then
Response.Write("selected")
end if
else
if x = month(now()) then
Response.Write("selected")
end if
end if
Response.Write(">"&x&"</option>")
next
%>
</select>月
<select name="col_day_1">
<%
for x = 1 to 31
Response.Write("<option value="&x&" ")
if col_day_1 <> "" then
if x = CInt(col_day_1) then
Response.Write("selected")
end if
else
if x = day(now()) then
Response.Write("selected")
end if
end if
Response.Write(">"&x&"</option>")
next
%>
</select>
日--
<select name="col_year_2">
<%
for x = 2006 to 2020
Response.Write("<option value="&x&" ")
if col_year_2 <> "" then
if x = CInt(col_year_2) then
Response.Write("selected")
end if
else
if x = year(now()) then
Response.Write("selected")
end if
end if
Response.Write(">"&x&"</option>")
next
%>
</select>年
<select name="col_month_2">
<%
for x = 1 to 12
Response.Write("<option value="&x&" ")
if col_month_2 <> "" then
if x = CInt(col_month_2) then
Response.Write("selected")
end if
else
if x = month(now()) then
Response.Write("selected")
end if
end if
Response.Write(">"&x&"</option>")
next
%>
</select>月
<select name="col_day_2">
<%
for x = 1 to 31
Response.Write("<option value="&x&" ")
if col_day_2 <> "" then
if x = CInt(col_day_2) then
Response.Write("selected")
end if
else
if x = day(now()) then
Response.Write("selected")
end if
end if
Response.Write(">"&x&"</option>")
next
%>
</select>日</p><input type="submit" value="提交" name="B1" checked>
</form>
</body>
</html>
帮我看看这段程序为什么当日期选择会出错