淘先锋技术网

首页 1 2 3 4 5 6 7
 

//判断有效日期
function isDate(val){
     if(document.getElementByIdx(val).value.match(/^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/)==null){
          alert("请输入有效的日期!");
          document.getElementByIdx(val).focus();
    return false;
  }
  return true;    
 }

function funcontact(){
   var beginTime=document.frm.begin_time.value;
   var endTime=document.frm.end_time.value;
   if(isDate('begin_time')&& isDate('end_time')){
    var supperId=document.frm.supper_id.value;
    var b=beginTime.replace(/-/g, "/");//2010-04-29  2010/04/29
    var e=endTime.replace(/-/g, "/");
    var dt1=new Date(Date.parse(b));
                             var dt2=new Date(Date.parse(e));
             
             if(dt1>dt2){//比较日期
              alert("开始日期不能晚于结束日期!");
              return;
             }else{
              location.href="/vrm/user/HeYueCtrl?supper_id=" target="_blank" rel="external nofollow" +supperId+"&begin_time="+beginTime+"&end_time="+endTime+"";
     return;
             }
    
   }
 }