- <script language="JavaScript">
- function Check(){
- var errorinfo = "";
- var isFocus = true;
- var groupUserName = document.getElementsByName("Custom.groupUserName")[0];
- if (groupUserName.value == ""){
- errorinfo += "机构客户名称为必填项,请输入!/n";
- if(isFocus){
- groupUserName.focus();
- isFocus = false;
- }
- }
- var enterpriseAddress = document.getElementsByName("Custom.enterpriseAddress")[0];
- if (enterpriseAddress.value == ""){
- errorinfo += "客户办公地址为必填项,请输入!/n";
- if(isFocus){
- enterpriseAddress.focus();
- isFocus = false;
- }
- }
- var postcode = document.getElementsByName("Custom.postcode")[0];
- if (postcode.value == ""){
- errorinfo += "邮政编码为必填项,请输入!/n";
- if(isFocus){
- postcode.focus();
- isFocus = false;
- }
- }else{
- var patrn=/^[a-zA-Z0-9 ]{3,12}$/;
- if (!patrn.exec(postcode.value)){
- errorinfo += "你输入的邮政编码格式不正确,请重新输入!/n";
- if(isFocus){
- postcode.focus();
- isFocus = false;
- }
- }
- }
- var checkSub = document.getElementsByName("Custom.checkSub")[0];
- if (checkSub.value == 0){
- errorinfo += "是否验证子客户为必填项,请输入!/n";
- if(isFocus){
- checkSub.focus();
- isFocus = false;
- }
- }
- var principalName = document.getElementsByName("Custom.principalName")[0];
- if (principalName.value == ""){
- errorinfo += "法人代表为必填项,请输入!/n";
- if(isFocus){
- principalName.focus();
- isFocus = false;
- }
- }
- var passportId = document.getElementsByName("Custom.passportId")[0];
- if (passportId.value == ""){
- errorinfo += "法人代表的身份证号码为必填项,请输入!/n";
- if(isFocus){
- passportId.focus();
- isFocus = false;
- }
- }else{
- var patrn=/^(([0-9]{14}[x0-9]{1})|([0-9]{17}[x0-9]{1}))$/;
- if (!patrn.exec(passportId.value)){
- errorinfo += "你输入法人代表的身份证号码格式不正确,请输入15位或者18位的身份证号码!/n";
- if(isFocus){
- passportId.focus();
- isFocus = false;
- }
- }
- }
- var delegateName = document.getElementsByName("DelegateInfo1.delegateName")[0];
- if (delegateName.value == ""){
- errorinfo +="客户经办人(1)姓名为必填项,请输入!/n";
- if(isFocus){
- delegateName.focus();
- isFocus = false;
- }
- }
- var delegateId = document.getElementsByName("DelegateInfo1.delegateId")[0];
- if (delegateId.value == ""){
- errorinfo += "客户经办人(1)的身份证号码为必填项,请输入!/n";
- if(isFocus){
- delegateId.focus();
- isFocus = false;
- }
- }else{
- var patrn=/^(([0-9]{14}[x0-9]{1})|([0-9]{17}[x0-9]{1}))$/;
- if (!patrn.exec(delegateId.value)){
- errorinfo += "你输入的客户经办人(1)的身份证号码格式不正确,请输入15位或者18位的身份证号码!/n";
- if(isFocus){
- delegateId.focus();
- isFocus = false;
- }
- }
- }
- var delegateDuty = document.getElementsByName("DelegateInfo1.delegateDuty")[0];
- if (delegateDuty.value == ""){
- errorinfo +="你输入客户经办人(1)的职务为必填项,请输入!/n";
- if(isFocus){
- delegateDuty.focus();
- isFocus = false;
- }
- }
- var delegateTelephone = document.getElementsByName("DelegateInfo1.delegateTelephone")[0];
- if (delegateTelephone.value == ""){
- errorinfo += "你输入客户经办人(1)的固定电话为必填项,请输入!/n";
- if(isFocus){
- delegateTelephone.focus();
- isFocus = false;
- }
- }else{
- var patrn=/^((/(/d{2,3}/))|(/d{3}/-))?(/(0/d{2,3}/)|0/d{2,3}-)?[1-9]/d{6,7}(/-/d{1,4})?$/;
- if (!patrn.exec(delegateTelephone.value)){
- errorinfo += "你输入的固定电话格式不正确,请重新输入!/n";
- if(isFocus){
- delegateTelephone.focus();
- isFocus = false;
- }
- }
- }
- var delegateMobile = document.getElementsByName("DelegateInfo1.delegateMobile")[0];
- if (delegateMobile.value == ""){
- errorinfo += "你输入客户经办人(1)的移动电话为必填项,请输入!/n";
- if(isFocus){
- delegateMobile.focus();
- isFocus = false;
- }
- }else{
- var patrn=/^((/(/d{2,3}/))|(/d{3}/-))?13/d{9}$/;
- if (!patrn.exec(delegateMobile.value)){
- errorinfo += "你输入的移动电话格式不正确,请重新输入!/n";
- if(isFocus){
- delegateMobile.focus();
- isFocus = false;
- }
- }
- }
- var delegateFax = document.getElementsByName("DelegateInfo1.delegateFax")[0];
- if (delegateFax.value == ""){
- errorinfo += "你输入客户经办人(1)的传真为必填项,请输入!/n";
- if(isFocus){
- delegateFax.focus();
- isFocus = false;
- }
- }else{
- var patrn=/^((/(/d{2,3}/))|(/d{3}/-))?(/(0/d{2,3}/)|0/d{2,3}-)?[1-9]/d{6,7}(/-/d{1,4})?$/;
- if (!patrn.exec(delegateFax.value)){
- errorinfo += "你输入的传真格式不正确,请重新输入!/n";
- if(isFocus){
- delegateFax.focus();
- isFocus = false;
- }
- }
- }
- var delegateEmail = document.getElementsByName("DelegateInfo1.delegateEmail")[0];
- if (delegateEmail.value == ""){
- errorinfo += "你输入客户经办人(1)的邮箱地址为必填项,请输入!/n";
- if(isFocus){
- delegateEmail.focus();
- isFocus = false;
- }
- }else{
- var patrn=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(/.[a-zA-Z0-9_-])+/;
- if (!patrn.exec(delegateEmail.value)){
- errorinfo += "你输入的邮箱地址不正确,请重新输入!/n";
- if(isFocus){
- delegateEmail.focus();
- isFocus = false;
- }
- }
- }
- //-----------------------------------------2------------------
- var delegateId2 = document.getElementsByName("DelegateInfo2.delegateId")[0];
- if (delegateId2.value != ""){
- var patrn=/^(([0-9]{14}[x0-9]{1})|([0-9]{17}[x0-9]{1}))$/;
- if (!patrn.exec(delegateId2.value)){
- errorinfo += "你输入的客户经办人(2)身份证号码格式不正确,请输入15位或者18位的身份证号码!/n";
- if(isFocus){
- delegateId2.focus();
- isFocus = false;
- }
- }
- }
- var delegateTelephone2 = document.getElementsByName("DelegateInfo2.delegateTelephone")[0];
- if (delegateTelephone2.value != ""){
- var patrn=/^((/(/d{2,3}/))|(/d{3}/-))?(/(0/d{2,3}/)|0/d{2,3}-)?[1-9]/d{6,7}(/-/d{1,4})?$/;
- if (!patrn.exec(delegateTelephone2.value)){
- errorinfo += "你输入的的客户经办人(2)固定电话格式不正确,请重新输入!/n";
- if(isFocus){
- delegateTelephone2.focus();
- isFocus = false;
- }
- }
- }
- var delegateMobile2 = document.getElementsByName("DelegateInfo2.delegateMobile")[0];
- if (delegateMobile2.value != ""){
- var patrn=/^((/(/d{2,3}/))|(/d{3}/-))?13/d{9}$/;
- if (!patrn.exec(delegateMobile2.value)){
- errorinfo += "你输入的客户经办人(2)移动电话格式不正确,请重新输入!/n";
- if(isFocus){
- delegateMobile2.focus();
- isFocus = false;
- }
- }
- }
- var delegateFax2 = document.getElementsByName("DelegateInfo2.delegateFax")[0];
- if (delegateFax2.value != ""){
- var patrn=/^((/(/d{2,3}/))|(/d{3}/-))?(/(0/d{2,3}/)|0/d{2,3}-)?[1-9]/d{6,7}(/-/d{1,4})?$/;
- if (!patrn.exec(delegateFax2.value)){
- errorinfo += "你输入的客户经办人(2)传真格式不正确,请重新输入!/n";
- if(isFocus){
- delegateFax2.focus();
- isFocus = false;
- }
- }
- }
- var delegateEmail2 = document.getElementsByName("DelegateInfo2.delegateEmail")[0];
- if (delegateEmail2.value != ""){
- var patrn=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(/.[a-zA-Z0-9_-])+/;
- if (!patrn.exec(delegateEmail2.value)){
- errorinfo += "你输入的客户经办人(2)邮箱地址不正确,请重新输入!/n";
- if(isFocus){
- delegateEmail2.focus();
- isFocus = false;
- }
- }
- }
- var delegateName2 = document.getElementsByName("DelegateInfo2.delegateName")[0];
- if (delegateId2.value != "" ||delegateTelephone2.value !="" || delegateMobile2.value != "" ||delegateFax2.value !="" || delegateEmail2.value !=""){
- if (delegateName2.value == ""){
- errorinfo+= "客户经办人(2)姓名没有输入,请输入!";
- if(isFocus){
- delegateName2.focus();
- isFocus = false;
- }
- }
- }
- var saleOfYear = document.getElementsByName("Custom.saleOfYear")[0];
- if (saleOfYear.value != ""){
- var patrn=/^((-?|/+?)/d+)(/./d+)?$/;
- if (!patrn.exec(saleOfYear.value)){
- errorinfo += "你输入的年销售/营业额不正确,只能够为数字类型,请重新输入!/n";
- if(isFocus){
- saleOfYear.focus();
- isFocus = false;
- }
- }
- }
- var payoutOfYear = document.getElementsByName("Custom.payoutOfYear")[0];
- if (payoutOfYear.value == ""){
- errorinfo += "你输入年估计/实际机票支出为必填项,请输入!/n";
- if(isFocus){
- payoutOfYear.focus();
- isFocus = false;
- }
- }
- else{
- var patrn=/^((-?|/+?)/d+)(/./d+)?$/;
- if (!patrn.exec(payoutOfYear.value)){
- errorinfo += "你输入的年估计/实际机票支出不正确,只能够为数字类型,请重新输入!/n";
- if(isFocus){
- payoutOfYear.focus();
- isFocus = false;
- }
- }
- }
- var numberOfUser = document.getElementsByName("Custom.numberOfUser")[0];
- if (numberOfUser.value == ""){
- errorinfo += "你输入机构客户人数为必填项,请输入!/n";
- if(isFocus){
- numberOfUser.focus();
- isFocus = false;
- }
- }
- else{
- var patrn=/^[0-9]*[1-9][0-9]*$/;
- if (!patrn.exec(numberOfUser.value)){
- errorinfo += "你输入的机构客户人数不正确,只能够为整数类型,请重新输入!/n";
- if(isFocus){
- numberOfUser.focus();
- isFocus = false;
- }
- }
- }
- var estimateTraveller = document.getElementsByName("Custom.estimateTraveller")[0];
- if (estimateTraveller.value == ""){
- errorinfo += "你输入年计划出行人数为必填项,请输入!/n";
- if(isFocus){
- estimateTraveller.focus();
- isFocus = false;
- }
- }
- else{
- var patrn=/^[0-9]*[1-9][0-9]*$/;
- if (!patrn.exec(estimateTraveller.value)){
- errorinfo += "你输入的年计划出行人数不正确,只能够为整数类型,请重新输入!/n";
- if(isFocus){
- estimateTraveller.focus();
- isFocus = false;
- }
- }
- }
- var frequentlyDestination = document.getElementsByName("Custom.frequentlyDestination")[0];
- if (frequentlyDestination.value == ""){
- errorinfo += "你输入经常出行地点为必填项,请输入!/n";
- if(isFocus){
- frequentlyDestination.focus();
- isFocus = false;
- }
- }
JS 验证
最新推荐文章于 2024-08-04 16:33:59 发布