入参为select标签ID
function del(obj) {
var items = document.getElementById(obj);
var sobj = (function() {
var _sobj = {};
for (var i = 0; i < items.options.length; i++) {
_sobj[items.options[i].text] = 1;
}
return _sobj;
})();
items.options.length = 0;
var _cx = 0;
for (var i in sobj) {
items.options[_cx] = new Option(i, i);
_cx += 1;
}
}
// 判断时间段长度单位(天)
function checkTime(){
var kprqq = $("#search_kprqq").val();
var kprqz = $("#search_kprqz").val();
if(kprqq!=null&&kprqz!=null){
var s1 = new Date(kprqq.replace(/-/g, "/"));
var s2 = new Date(kprqz.replace(/-/g, "/"));
var days = s2.getTime() - s1.getTime();
var time = parseInt(days / (1000 * 60 * 60 * 24));
if(time>31){
alert("选取时间段超过31天! 请重新选择!!!");
return false;
}
}
return true;
}
校验是否为空
function checkTime(){
var begintime = document.getElementById('startTime').value;
var endtime = document.getElementById('endTime').value;
if(!endtime){
return true;
}
var time1 = new Date(begintime).getTime();
var time2 = new Date(endtime).getTime();
if(begintime==''){
alert("开始时间不能为空");
return false;
}
if(endtime==''){
alert("结束时间不能为空");
return false;
}
if(time1 > time2){
alert("开始时间不能大于结束时间");
return false;
}
}