<form action="" method="post" name="form" id="form1" onSubmit="return checkdata()">
改为:
<form action="" method="post" name="form" id="form1" onSubmit="return checkdata(open_date.value)">
改为:
<form action="" method="post" name="form" id="form1" onSubmit="return checkdata(open_date.value)">
<form action="" method="post" name="form" id="form1" onSubmit="return checkdata(this)">
javascript:
function CheckDate(theform)
{
var strDate=theform.open_date.value;
var reg=/^(\d{4})([-])(\d{2})([-])(\d{2})/;
if(!reg.test(strDate))
{
alert("日期格式不正确!\n正确格式为:2008-01-01");
return false;
}
var ss=strDate.split("-");
var year=ss[0];
var month=ss[1];
var date=ss[2];
if(!checkYear(year)){return false;}
if(!checkMonth(month)){return false;}
if(!checkDate(year,month,date)){return false;}
return true;
}
form里就是改用checkdata()吧?
我还有其他的不光是日期,不能直接调用CheckDate(str)啊?是不是?