<!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>
function check(){
var str=document.getElementById("flag").value;
/**
2008/3/15或2008-3-15
**/
//var isCorrect = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
/**
99999.9999
**/
var isCorrect = str.match(/^(\d*)(.)(\d*)$/);
if (isCorrect == null) alert('校验失败!');
}
</script>
</HEAD>
<BODY>
<form>
<input type="text" id="flag"/>
<input type="button" value="check" onclick="check()"/>
</form>
</BODY>
</HTML>