日期:2014-05-16 浏览次数:20356 次
<HTML> <HEAD> <meta name=vs_targetSchema content="HTML 4.0"> <meta name=vs_defaultClientScript content="JavaScript"> <script language="javascript"> function Checkform(form) { var str=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/ if(!str.test(form.date.value)) { alert('请输入正确的时间格式'); form.date.focus(); return false; } else { alert("OK~!"); } return true; } </script> </HEAD> <BODY> <form name="form1" method="post" action="" onSubmit="return Checkform(this);"> <input name="date" type="text" id="date" size="20" maxlength="19"> <input type="submit" name="Submit" value="提交"> </form> </BODY> </HTML>