一个时间验证的例子
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script language="JavaScript">function demo(){var strDate = "2008-11-01";var s=strDate.split("-"); var date=new Date(parseInt(s),parseInt(s)-1,parseInt(s)); date.setHours("12");date.setMinutes("40");var firstTime2 = new Date(parseInt(s),parseInt(s)-1,parseInt(s)); firstTime2.setHours("12");firstTime2.setMinutes("30");alert("aaaaa>>" +date.toLocaleString());alert("bbbb>>" +firstTime2.toLocaleString());if(date>firstTime2){alert("false");}else{alert("true");}}</script></head><body ><input type="button" name="demo" ></body></html>
页:
[1]