客户端的一些处理技术

<script language="javascript">

    function ShowCountries(i)//选择国籍
   {
  //alert("ShowCountries.aspx?CName=Nationality" +i +"&CID=hiddenCID"+i);  
  window.open("ShowCountries.aspx?CName=Nationality" +i +"&CID=hiddenCID"+i,"","resizable=yes,scrollbars=yes,width=650,height=500");
  
 }
  function ShowAirDelivery()//查看该城市配送范围和收费说明
 {
  var townid=document .getElementById ("BookThird1_ddlDeliveryCityID").options[document .getElementById ("BookThird1_ddlDeliveryCityID").selectedIndex].text;
  window.open('ShowDeliveryInfo.aspx?CityName=' + townid , '', 'resizable=no,scrollbars=yes,width=510,height=300')
  }
 

 
function CheckContactInfo()//验证旅客信息 和 验证联系人信息
{
   //alert(document .getElementById ("PaymentTypeID01").value);return false;
    //验证旅客填写的信息
  var hh=document .getElementById ("BookThird1_LKhidden").value;
  for(var i=1;i<=hh;i++)
  {
    var stemp=document.getElementById("PassengerName"+i+"").value;
    if(stemp=="")
    {
     document.getElementById("PassengerName"+i+"").focus();
     alert("请输入旅客姓名!");
     return false;
    }   
  }
  
  for(var i=1;i<=hh;i++)
  {
    var stemp=document.getElementById("CertificationNO"+i+"").value;
    if(stemp=="")
    {
     document.getElementById("CertificationNO"+i+"").focus();
     alert("证件号不能为空!");
     return false;
    }   
    if (document .getElementById ("CertificationTypeID"+i+"").value==1)
    {
      var stemp=document.getElementById("CertificationNO"+i+"");
      if (isIdCardNo(stemp.value)==false)
      {
       stemp.focus();
       return false;
      }
    } 
    
  }
  
  
   
   //验证联系人信息
  if (document .getElementById ("BookThird1_txtContactName").value=="")
  {
   alert("联系人不能为空");
   document .getElementById ("BookThird1_txtContactName").focus();
   return false;
  }
  
  if (document .getElementById ("BookThird1_txtMobile").value=="")
  {
   alert("联系人手机不能为空");
   document .getElementById ("BookThird1_txtMobile").focus();
   return false;
  }
  
  if (document .getElementById ("BookThird1_ddlContactTypeID").options[document .getElementById ("BookThird1_ddlContactTypeID").selectedIndex].text=="电话")
  {
   if(document .getElementById ("BookThird1_txtTelephone").value.length==0)
   {
    alert("您选择联系方式为电话后,电话号不能为空!");
    document .getElementById ("BookThird1_txtTelephone").focus();
    return false;
   }
  }
  
   //验证Email
      if(document .getElementById ("BookThird1_txtEmail").value!="")
      {
    var strRegExp;
    strRegExp=//w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*/;
     
    var regTmp;
    var macthAry;
    regTmp = new RegExp(strRegExp);
    macthAry = regTmp.exec(document .getElementById ("BookThird1_txtEmail").value);
    if (macthAry != null)
    {
     return true;
    }
    else
    {
     alert("Email地址格式不正确!");
     document .getElementById ("BookThird1_txtEmail").focus();
     return false;
    }
   }
   
  if (document .getElementById ("BookThird1_ddlContactTypeID").options[document .getElementById ("BookThird1_ddlContactTypeID").selectedIndex].text=="Email" )
  {
   if(document .getElementById ("BookThird1_txtEmail").value.length==0)
   {
    alert("您选择联系方式为Email后,Email不能为空!");
    document .getElementById ("BookThird1_txtEmail").focus();
    return false;
   }
  }
  
  if (document .getElementById ("BookThird1_ddlContactTypeID").options[document .getElementById ("BookThird1_ddlContactTypeID").selectedIndex].text=="传真")
  {
   if(document .getElementById ("BookThird1_txtFaxNO").value.length==0)
   {
    alert("您选择联系方式为传真后,传真不能为空!");
    document .getElementById ("BookThird1_txtFaxNO").focus();
    return false;
   }
  }
  
  if (document.getElementById ("BookThird1_ddlDeliveryTypeID").options[document.getElementById ("BookThird1_ddlDeliveryTypeID").selectedIndex].text=="上门送票" || document.getElementById ("BookThird1_ddlDeliveryTypeID").options[document.getElementById ("BookThird1_ddlDeliveryTypeID").selectedIndex].text=="EMS")
  {
   if (document .getElementById ("BookThird1_txtDeliveryAddress").value.length==0)
   {
    alert("您选择了上门送票或EMS后请您填写地址,以方便我们为你服务!");
    document .getElementById ("BookThird1_txtDeliveryAddress").focus();
    return false;
   }
  }
  
  //验证预定须知
  if (document .getElementById ("chkReadOK").checked==false)
  {
   alert("不接受预定须知不能进行下一步!");
   document .getElementById ("chkReadOK").focus();
   return false;
  }
 return true;
}
</script>

<script language="javascript">
function  isIdCardNo(num)
{
    //验证身份证号码
  if (num=="")
      {
           alert("请输入证件号码!");
          
     return false;
       }
        if (isNaN(num))
             {
                   alert("身份证号码应为数字!");
                   return  false;
             }
            
        var len=num.length, re;     
        if  (len ==15)
                re= new  RegExp(/^(/d{6})()?(/d{2})(/d{2})(/d{2})(/d{3})$/);
        else  if (len ==18)
                re=new   RegExp(/^(/d{6})()?(/d{4})(/d{2})(/d{2})(/d{3})(/d)$/);
        else     
        {
        alert("身份证号码位数不对!");
              return    false;
        }
       
        var   a=num.match(re);
       
        if   (a !=null)
        {
                if  (len==15)
                {
                        var  D= new  Date("19"+a[3]+"/"+a[4]+"/"+a[5]);
                        var  B= D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
                  
                       var year="19"+D.getYear()+"-";
                       var month=D.getMonth()+1;
                       if (month<10)
                       {
       month="0"+month;
                       }
                       var day=D.getDate();
                        if (day<10)
                       {
       day="0"+day;
                       }
                       var date=year+month+"-"+day;//得到身份证上的生日号码
                      //alert(date);
                }
               
                else
                {
                        var  D= new  Date(a[3]+"/"+a[4]+"/"+a[5]);
                        var  B=D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
                       
                       var year1=D.getFullYear()+"-";
                       var month1=D.getMonth()+1;
                       if (month1<10)
                       {
       month1="0"+month1;
                       }
                       var day1=+D.getDate();
                       if (day1<10)
                       {
       day1="0"+day1;
                       }
                       var date1=year1+month1+"-"+day1;//得到身份证上的生日号码
                    // alert(date1);
                }
               
                if  (!B)
                     {
                          alert("输入的身份证号 "+  a[0] +"   里出生日期不对!");
                          return      false;
                    }
        }
        return  true;
}

function  GetCardNo() //得到身份证号码给出生日期文本框赋值
{
  
 var hh=document .getElementById ("BookThird1_LKhidden").value;
 for(var i=1;i<=hh;i++)
 {
 
    if (document .getElementById ("CertificationTypeID"+i+"").value==1)
   {
      if (document .getElementById ("CertificationNO"+i+"").value!="")
      {
       if (isIdCardNo(document .getElementById ("CertificationNO"+i+"").value)==false)//验证身份证号码
       {
        document.getElementById("Birthday"+i+"").value="";
        
        return false;
       }
       var stemp=document.getElementById("CertificationNO"+i+"").value;
       var len=stemp.length, re;     
       if  (len ==15)
         re= new  RegExp(/^(/d{6})()?(/d{2})(/d{2})(/d{2})(/d{3})$/);
       else  if (len ==18)
         re=new   RegExp(/^(/d{6})()?(/d{4})(/d{2})(/d{2})(/d{3})(/d)$/);
         
       var   a=stemp.match(re);
       if   (a !=null)
       {
         if  (len==15)
         {
           var  D= new  Date("19"+a[3]+"/"+a[4]+"/"+a[5]);
           var  B= D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
            
          var year="19"+D.getYear()+"-";
          var month=D.getMonth()+1;
          if (month<10)
          {
            month="0"+month;
          }
          var day=D.getDate();
           if (day<10)
          {
            day="0"+day;
          }
          var date=year+month+"-"+day;//得到身份证上的生日号码
          document.getElementById("Birthday"+i+"").value= date;
         }
         
         else
         {
           var  D= new  Date(a[3]+"/"+a[4]+"/"+a[5]);
           var  B=D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
                
           var year1=D.getFullYear()+"-";
           var month1=D.getMonth()+1;
           if (month1<10)
           {
             month1="0"+month1;
           }
           var day1=+D.getDate();
           if (day1<10)
           {
             day1="0"+day1;
           }
           var date1=year1+month1+"-"+day1;//得到身份证上的生日号码
           document.getElementById("Birthday"+i+"").value=date1;
         }
       }
    } 
  }
 }
  
}


    function  WriteXML()
    {
  var oDoc = new ActiveXObject("MSXML2.DOMDocument");
  var xeRoot=oDoc.createElement("BookingInfo3");
  oDoc.appendChild (xeRoot);
  
  var xePassengerInfo=oDoc.createElement ("PassengerInfo");
  xeRoot.appendChild (xePassengerInfo);
  
  var hh=document .getElementById ("BookThird1_LKhidden").value;
  for(var i=1;i<=hh;i++)
  {
   var xePassenger=oDoc.createElement ("Passenger");
   xePassengerInfo.appendChild(xePassenger);
   
   var xeOrderID=oDoc.createElement ("OrderID");//订单ID
   xeOrderID.text="未生成订单号";
   xePassenger.appendChild(xeOrderID);
   
   var xePassengerName=oDoc.createElement ("PassengerName");//出行人员姓名
   xePassengerName.text=document.getElementById("PassengerName"+i).value;
   xePassenger.appendChild(xePassengerName);
   
  
   var xexePassengerTypeID=oDoc.createElement ("PassengerTypeID");//出行人员类型ID
      if (document.getElementById("PassengerTypeID"+i).innerText=="成人")
   {
      xexePassengerTypeID.text="1";
   }
    if (document.getElementById("PassengerTypeID"+i).innerText=="儿童")
   {
      xexePassengerTypeID.text="2";
   }
   xePassenger.appendChild(xexePassengerTypeID);
    
   var xePassengerType=oDoc.createElement ("PassengerType");//出行人员类型名称
   xePassengerType.text=document.getElementById("PassengerTypeID"+i).innerText;
   xePassenger.appendChild(xePassengerType);
   
   var xeCertificationTypeID=oDoc.createElement ("CertificationTypeID");//证件类型ID
   xeCertificationTypeID.text=document.getElementById("CertificationTypeID"+i).value;
   xePassenger.appendChild(xeCertificationTypeID);
   
   var xeCertificationType=oDoc.createElement ("CertificationType");//证件类型名称
   xeCertificationType.text=document.getElementById("CertificationTypeID"+i).options[document.getElementById("CertificationTypeID"+i).selectedIndex].text;
   xePassenger.appendChild(xeCertificationType);
   
   var xeCertificationNO=oDoc.createElement ("CertificationNO");//证件号码
   xeCertificationNO.text=document.getElementById("CertificationNO"+i).value;
   xePassenger.appendChild(xeCertificationNO);
   
   var xePhoneNO=oDoc.createElement ("PhoneNO");//电话
   xePhoneNO.text=document.getElementById("PhoneNO"+i).value;
   xePassenger.appendChild(xePhoneNO);
   
   var xeNationalityID=oDoc.createElement ("NationalityID");//国别
   xeNationalityID.text=document.getElementById("hiddenCID"+i).value;
   xePassenger.appendChild(xeNationalityID);
   
   var xeNationality=oDoc.createElement ("Nationality");//国别名称
   xeNationality.text=document.getElementById("Nationality"+i).value;
   xePassenger.appendChild(xeNationality);
   
   var xeBirthday=oDoc.createElement ("Birthday");//生日
   xeBirthday.text=document.getElementById("Birthday"+i).value;
   xePassenger.appendChild(xeBirthday);
   
   var xeGender=oDoc.createElement ("Gender");//性别
   xeGender.text=document.getElementById("Gender"+i).options[document.getElementById("Gender"+i).selectedIndex].text;
   xePassenger.appendChild(xeGender);
   
   
   
  }
  
  var xeMainInfo=oDoc.createElement ("MainInfo");
  xeRoot.appendChild (xeMainInfo);
  
  var xeContactName=oDoc.createElement ("ContactName");//联系人姓名
  xeContactName.text=document .getElementById ("BookThird1_txtContactName").value;
  xeMainInfo.appendChild(xeContactName);
  
  var xeMobile=oDoc.createElement ("Mobile");//联系人手机
  xeMobile.text=document .getElementById ("BookThird1_txtMobile").value;
  xeMainInfo.appendChild(xeMobile);
  
  var xeTelephone=oDoc.createElement ("Telephone");//联系人电话
  xeTelephone.text=document .getElementById ("BookThird1_txtTelephone").value;
  xeMainInfo.appendChild(xeTelephone);
  
  var xeFaxNO=oDoc.createElement ("FaxNO");//联系人传真
  xeFaxNO.text=document .getElementById ("BookThird1_txtFaxNO").value;
  xeMainInfo.appendChild(xeFaxNO);
  
  var xeEmail=oDoc.createElement ("Email");//联系人Email
  xeEmail.text=document .getElementById ("BookThird1_txtEmail").value;
  xeMainInfo.appendChild(xeEmail);
  
  var xeContactTypeID=oDoc.createElement ("ContactTypeID");//联系方式ID
  xeContactTypeID.text=document .getElementById ("BookThird1_ddlContactTypeID").value;
  xeMainInfo.appendChild(xeContactTypeID);
  
  var xeContactType=oDoc.createElement ("ContactType");//联系方式描述
  xeContactType.text=document .getElementById ("BookThird1_ddlContactTypeID").options[document .getElementById ("BookThird1_ddlContactTypeID").selectedIndex].text;
  xeMainInfo.appendChild(xeContactType);
  
  var xeDeliveryTypeID=oDoc.createElement ("DeliveryTypeID");//配送类型ID
  xeDeliveryTypeID.text=document .getElementById ("BookThird1_ddlDeliveryTypeID").value;
  xeMainInfo.appendChild(xeDeliveryTypeID);
  
  var xeDeliveryType=oDoc.createElement ("DeliveryType");//配送类型描述
  xeDeliveryType.text=document .getElementById ("BookThird1_ddlDeliveryTypeID").options[document .getElementById ("BookThird1_ddlDeliveryTypeID").selectedIndex].text;
  xeMainInfo.appendChild(xeDeliveryType);
  
  var xeDeliveryCityID=oDoc.createElement ("DeliveryCityID");//送票城市ID
  xeDeliveryCityID.text=document .getElementById ("BookThird1_ddlDeliveryCityID").value;
  xeMainInfo.appendChild(xeDeliveryCityID);
  
  var xeDeliveryCity=oDoc.createElement ("DeliveryCity");//送票城市名称
  xeDeliveryCity.text=document .getElementById ("BookThird1_ddlDeliveryCityID").options[document .getElementById ("BookThird1_ddlDeliveryCityID").selectedIndex].text;
  xeMainInfo.appendChild(xeDeliveryCity);
  
  var xeDeliveryAddress=oDoc.createElement ("DeliveryAddress");//送票地址
  xeDeliveryAddress.text=document .getElementById ("BookThird1_txtDeliveryAddress").value;
  xeMainInfo.appendChild(xeDeliveryAddress);
  
  var xeInvoiceTitle=oDoc.createElement ("InvoiceTitle");//发票抬头
  xeInvoiceTitle.text=document .getElementById ("BookThird1_txtInvoiceTitle").value;
  xeMainInfo.appendChild(xeInvoiceTitle);
  
  var xeInvoiceTypeID=oDoc.createElement ("InvoiceTypeID");//发票类型ID
  xeInvoiceTypeID.text=document .getElementById ("BookThird1_ddlInvoiceTypeID").value;
  xeMainInfo.appendChild(xeInvoiceTypeID);
  
  var xeInvoiceType=oDoc.createElement ("InvoiceType");//发票类型描述
  xeInvoiceType.text=document .getElementById ("BookThird1_ddlInvoiceTypeID").options[document .getElementById ("BookThird1_ddlInvoiceTypeID").selectedIndex].text;
  xeMainInfo.appendChild(xeInvoiceType);
  
  var kk=document .getElementById ("BookThird1_hiddenPayType").value;
  for(var k=1;k<=kk;k++)
  {
   if(document .getElementById ("PaymentTypeID"+k).checked==true)
   {
    var xePaymentTypeID=oDoc.createElement ("PaymentTypeID");//支付类型ID
    xePaymentTypeID.text=document .getElementById ("PaymentTypeID"+k).value;
    xeMainInfo.appendChild(xePaymentTypeID);
    
    var xePaymentType=oDoc.createElement ("PaymentType");//支付类型描述
    xePaymentType.text=document .getElementById ("DivPayType"+k).innerText;
    xeMainInfo.appendChild(xePaymentType);
   }
  }
  var xeSpecialRequest=oDoc.createElement ("SpecialRequest");//特殊需求
  xeSpecialRequest.text=document .getElementById ("BookThird1_txtSpecialRequest").value;
  xeMainInfo.appendChild(xeSpecialRequest);
  
  var strXML = "<?xml version='1.0' encoding='utf-8'?>"+oDoc.xml;
  document.getElementById("BookThird1_hiddenXML").value=strXML;
       // document.getElementById("BookThird1_hiddenXML").value = base64encode(strUnicode2Ansi(strXML));
  alert(strXML);
    }
</script> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值