标签:io java ar for art sp cti on c
第一种适用于:20100823这种字符串格式
function dateValid(){
var bd = document.getElementById("sStartSaveDate").value;
var beginDate = new Date(bd.replace(/^(\d{4})(\d{2})(\d{2})$/,"$1/$2/$3"));
var ed = document.getElementById("sEndSaveDate").value;
var endDate = new Date(ed.replace(/^(\d{4})(\d{2})(\d{2})$/,"$1/$2/$3"));
if(beginDate >= endDate){
alert("结束时间必须大于开始时间!");
return false;
}else{
document.getElementById(‘searchform‘).submit();
}
}
第二种适用于:2010-08-23这种字符串格式
function dateValid(){
var beginDate = new Date(document.getElementById("sStartSaveDate").value.replace(/-/g,"/"));
var endDate = new Date(document.getElementById("sEndSaveDate").value.replace(/-/g,"/"));
if(beginDate >= endDate){
alert("结束时间必须大于开始时间!");
return false;
}else{
document.getElementById(‘searchform‘).submit();
}
第三种适用于:2010/08/23这种字符串格式
function dateValid(){
var beginDate = new Date(document.getElementById("sStartSaveDate").value);
var endDate = new Date(document.getElementById("sEndSaveDate").value);
if(beginDate >= endDate){
alert("结束时间必须大于开始时间!");
return false;
}else{
document.getElementById(‘searchform‘).submit();
}
}
标签:io java ar for art sp cti on c
原文地址:http://www.cnblogs.com/tanshupeng/p/3977516.html