日期:2014-05-16 浏览次数:20376 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script language=javascript> String.prototype.isTime = function() { var r = this.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2})$/); if(r==null)return false; var d = new Date(r[1], r[3]-1,r[4],r[5],r[6],0); return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]); } alert("2002-1-31 12:34".isTime()); alert("2001-2-29 12:54".isTime()); alert("2002-1-41 12:00".isTime()); String.prototype.isDate = function() { var r = this.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/); if(r==null)return false; var d = new Date(r[1], r[3]-1,r[4]); return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]); } alert("2002-1-31".isDate()); alert("2001-2-29".isDate()); alert("2002-1-41".isDate()); </script> </HEAD> <BODY> </BODY> </HTML>
?
?
js判断时间是否正确,js判断时间,js时间判断,时间判断
?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
蕃薯耀 2012年9月27日 星期四