a.js的内容
function isInvalidDate(theDate,separator){
default_style=1
if (theDate.length>10 || theDate.length<8)
return true
idx1=theDate.indexOf(separator)
if (idx1==-1)
return true
idx2=theDate.indexOf(separator,idx1+1)
if (idx2==-1)
return true
if (isInvalidDate.arguments.length>2)
default_style=isInvalidDate.arguments[2]
if (default_style<1 || default_style>9){
alert("传入参数有误!请检查。")
return true
}
if (default_style==1){
theYear=theDate.substring(0,idx1)
theMonth=theDate.substring(idx1+1,idx2)
theDay=theDate.substring(idx2+1)
}
if (default_style==2){
theMonth=theDate.substring(0,idx1)
theDay=theDate.substring(idx1+1,idx2)
theYear=theDate.substring(idx2+1)
}
if (theDay.length>2)
return true
if (parseYMD(theYear,theMonth,theDay)>0)
return true
else
return false
}
function isInvalidDate(theDate,separator){
default_style=1
if (theDate.length>10 || theDate.length<8)
return true
idx1=theDate.indexOf(separator)
if (idx1==-1)
return true
idx2=theDate.indexOf(separator,idx1+1)
if (idx2==-1)
return true
if (isInvalidDate.arguments.length>2)
default_style=isInvalidDate.arguments[2]
if (default_style<1 || default_style>9){
alert("传入参数有误!请检查。")
return true
}
if (default_style==1){
theYear=theDate.substring(0,idx1)
theMonth=theDate.substring(idx1+1,idx2)
theDay=theDate.substring(idx2+1)
}
if (default_style==2){
theMonth=theDate.substring(0,idx1)
theDay=theDate.substring(idx1+1,idx2)
theYear=theDate.substring(idx2+1)
}
if (theDay.length>2)
return true
if (parseYMD(theYear,theMonth,theDay)>0)
return true
else
return false
}
else if (isInvalidDate('go2to.riqi.value',"-")==true)
改成
else if (isInvalidDate(go2to.riqi.value,"-")==true)
就OK啦