如何用JS或者ASP判断用户输入的日期在某个日期范围之内 如要求用户输入的日期必须在1950-01-01到207-12-31的范围之内 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 试试看:function isDateString(){ var sDate=document.Foo.Date.value; var iaMonthDays = [31,28,31,30,31,30,31,31,30,31,30,31] var iaDate = new Array(3) var year, month, day iaDate = sDate.toString().split("-") if (iaDate.length != 3) {alert("非法的日期"); return false;} if (isNaN(iaDate[0]) || isNaN(iaDate[1]) ||isNaN(iaDate[2])) {alert("非法的日期"); return false;} if (iaDate[0].length<1 || iaDate[0].length>4 || iaDate[1].length<1 || iaDate[1].length > 2 || iaDate[2].length <1 || iaDate[2].length>2) {alert("非法的日期"); return false;} year = parseFloat(iaDate[0]) month = parseFloat(iaDate[1]) day=parseFloat(iaDate[2]) if (year < 1950 || year > 2007) {alert("非法的日期"); return false;} if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1]=29; if (month < 1 || month > 12) {alert("非法的日期"); return false;} if (day < 1 || day > iaMonthDays[month - 1]) {alert("非法的日期"); return false;} alert("合法!"); return true;} STRUTS1 中错误页面怎么处理!散分! 菜鸟提问,各位大哥大姐帮忙看下 Struts2 action 跳转 到另一个 action 问题 如何让 frame自适应高度?? Hibernate搜索深度 如何用jsp调用MS SQL server的以下的存储过程? 看了一个关于分页的程序 谁能给个jsp网站权限控制的代码例子 在网页上显示图片出来 WebLogic使用问题 用jforum做论坛,请问jforum论坛采用的加密方式是什么啊? 用iReport做统计报表的问题,急呀!
function isDateString()
{
var sDate=document.Foo.Date.value;
var iaMonthDays = [31,28,31,30,31,30,31,31,30,31,30,31]
var iaDate = new Array(3)
var year, month, day
iaDate = sDate.toString().split("-")
if (iaDate.length != 3) {alert("非法的日期"); return false;}
if (isNaN(iaDate[0]) || isNaN(iaDate[1]) ||isNaN(iaDate[2])) {alert("非法的日期"); return false;}
if (iaDate[0].length<1 || iaDate[0].length>4
|| iaDate[1].length<1 || iaDate[1].length > 2
|| iaDate[2].length <1 || iaDate[2].length>2) {alert("非法的日期"); return false;}
year = parseFloat(iaDate[0])
month = parseFloat(iaDate[1])
day=parseFloat(iaDate[2]) if (year < 1950 || year > 2007) {alert("非法的日期"); return false;}
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1]=29;
if (month < 1 || month > 12) {alert("非法的日期"); return false;}
if (day < 1 || day > iaMonthDays[month - 1]) {alert("非法的日期"); return false;}
alert("合法!");
return true;
}