1 数字输入判断 :http://blog.163.com/mende_001/blog/static/611304352008810115037503/
2 验证日期输入大小
function validateDataRange(){
var fromtime = document.getElementById("fromDate.id").value;
var endtime = document.getElementById("toDate.id").value;
if(""==fromtime||""==endtime){
alert("Please select From Date or To Date!");
return false;
}
var fromh=$("#fromHour").val();
var fromm=$("#fromMin").val();
var toh=$("#toHour").val();
var tom=$("#toMin").val();
var datefrom = new Date(fromtime);
datefrom.setHours(fromh);
datefrom.setMinutes(fromm);
var dateend = new Date(endtime);
dateend.setHours(toh);
dateend.setMinutes(tom);
if(Date.parse(datefrom)>Date.parse(dateend)){
alert("The Date selected error!");
return false;
}
return true;
}
3 js 全部替换
approvalf="abcdfaa";
approvalf=approvalf.replace(/a/g,"-"); // /g 全局替换