重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

jQuery插进tooltip提示和validate

  1.  
  2.      

validate.js

创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于网站建设、成都做网站、儋州网络推广、重庆小程序开发公司、儋州网络营销、儋州企业策划、儋州品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联公司为所有大学生创业者提供儋州建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com

 

  1. function AddAbroadTravel(){} 
  2.  
  3. $().ready(function() { 
  4.     $("#abroadtravelForm").validate({ 
  5.         submitHandler:function(form){ 
  6.             if(!AddAbroadTravel.validateSchedule()){ 
  7.                 return; 
  8.             } 
  9.             var form = document.getElementById("abroadtravelForm"); 
  10.             form.encding="application/x-www-form-urlencoded"; 
  11.             form.action = "/admin/abroadTravelAction!showAbroadTravel"; 
  12.             form.target = "_self"; 
  13.             form.submit(); 
  14.         }, 
  15.         rules: { 
  16.             "info.travelName": { 
  17.                 required: true, 
  18.                 minlength: 2, 
  19.                 maxlength: 100 
  20.             }, 
  21.             "info.travelDeparture": { 
  22.                 required: true 
  23.             }, 
  24.             "info.travelDestin": { 
  25.                 required: true 
  26.             }, 
  27.             "info.travelRoomUsers": { 
  28.                 required: false, 
  29.                 digits:true 
  30.             }, 
  31.             "info.travelOnePersonRoom": { 
  32.                 minlength: 0, 
  33.                 maxlength: 100 
  34.             }, 
  35.             "info.travelDiningViews": { 
  36.                 required: false, 
  37.                 minlength: 0, 
  38.                 maxlength: 25 
  39.             }, 
  40.             "info.travelHotel": { 
  41.                 required: false, 
  42.                 minlength: 0, 
  43.                 maxlength: 50 
  44.             }, 
  45.             "info.travelTouristGuide": { 
  46.                 required: false, 
  47.                 minlength: 0, 
  48.                 maxlength: 50 
  49.             }, 
  50.             "info.travelConditions": { 
  51.                 required: false, 
  52.                 minlength: 0, 
  53.                 maxlength: 50 
  54.             }, 
  55.             "info.travelPeriod": { 
  56.                 required: true, 
  57.                 digits:true 
  58.             }, 
  59.             "info.travelAccomCity": { 
  60.                 required: false, 
  61.                 minlength: 0, 
  62.                 maxlength: 50 
  63.             }, 
  64.             "info.travelFuelCosts": { 
  65.                 required: false, 
  66.                 minlength: 0, 
  67.                 maxlength: 250 
  68.             }, 
  69.             "info.travelLocalTax": { 
  70.                 required: false, 
  71.                 minlength: 0, 
  72.                 maxlength: 250 
  73.             }, 
  74.             "info.travelAirportConstrFee": { 
  75.                 required: false, 
  76.                 minlength: 0, 
  77.                 maxlength: 250 
  78.             }, 
  79.             "info.travelChildrenPrice": { 
  80.                 required: false, 
  81.                 minlength: 0, 
  82.                 maxlength: 250 
  83.             }, 
  84.             "info.travelPoints": { 
  85.                 required: false, 
  86.                 minlength: 0, 
  87.                 maxlength: 250 
  88.             }, 
  89.             "info.travelOtherOptions": { 
  90.                 required: false, 
  91.                 minlength: 0, 
  92.                 maxlength: 250 
  93.             }, 
  94.             "info.travelNotes": { 
  95.                 required: false, 
  96.                 minlength: 0, 
  97.                 maxlength: 250 
  98.             }, 
  99.             "info.travelCommitment": { 
  100.                 required: false, 
  101.                 minlength: 0, 
  102.                 maxlength: 250 
  103.             }, 
  104.             "info.travelDepaTime": { 
  105.                 required: true 
  106.             } 
  107.         } 
  108.     }); 
  109.     var initTravelDeparture = jQuery("#initTravelDeparture").val(); 
  110.     var initTravelDestin = jQuery("#initTravelDestin").val(); 
  111.      
  112.     if(!initTravelDeparture) 
  113.         initTravelDeparture = ""; 
  114.          
  115.     if(!initTravelDestin) 
  116.         initTravelDestin = ""; 
  117.          
  118.     linkage.init('travelDeparture_select_country','travelDeparture_select_city',initTravelDeparture); 
  119.     linkage.init('travelDestin_select_country','travelDestin_select_city',initTravelDestin); 
  120.  
  121. }); 
  122.  
  123. //上传景点图片 
  124. AddAbroadTravel.uploadImg = function(){ 
  125.     var imgPath = jQuery("#upload").val(); 
  126.     if(imgPath){ 
  127.         var form = document.getElementById("abroadtravelForm"); 
  128.         form.encding="multipart/form-data"; 
  129.         form.action = "/admin/abroadTravelImgAction"; 
  130.         form.target = "uploadImgFrame"; 
  131.         form.submit(); 
  132.     } 
  133. }; 
  134.  
  135. //删除景点图片 
  136. AddAbroadTravel.delImg = function(imgA){ 
  137.     jQuery(imgA.parentNode.parentNode).remove(); 
  138. }; 
  139.  
  140. //追加日程 
  141. AddAbroadTravel.addSchedule = function(){ 
  142.     var imgsTables = document.getElementById("scheduleTable"); 
  143.     var tr = imgsTables.insertRow(imgsTables.rows.length); 
  144.     var strHtml = ''; 
  145.     strHtml += '日观光内容:'; 
  146.     strHtml += ''; 
  147.     strHtml += ' 居住酒店:'; 
  148.     strHtml += '  '; 
  149.     strHtml += 'X'; 
  150.     tr.innerHTML = strHtml; 
  151.     jQuery('#div2 [title]').tipsy({trigger: 'focus',fade: true}); 
  152. }; 
  153.  
  154. //删除日程 
  155. AddAbroadTravel.delSchedule = function(obj){ 
  156.     jQuery(obj.parentNode.parentNode).remove(); 
  157. }; 
  158.  
  159. //验证日程 
  160. AddAbroadTravel.validateSchedule = function(){ 
  161.     var scheduleDays = jQuery("input[name='scheduleDay']"); 
  162.     var scheduleContents = jQuery("textarea[name='scheduleContent']"); 
  163.     var scheduleHotels = jQuery("input[name='scheduleHotels']"); 
  164.  
  165.     var i = 0; 
  166.     for(i = 0; i < scheduleDays.length; i++){ 
  167.         if(!FM.STRING.isNum(jQuery(scheduleDays[i]).val())){ 
  168.             jQuery(scheduleDays[i]).focus(); 
  169.             return false; 
  170.         } 
  171.     } 
  172.  
  173.     for(i = 0; i < scheduleContents.length; i++){ 
  174.         if(jQuery(scheduleContents[i]).val().length > 250){ 
  175.             jQuery(scheduleContents[i]).focus(); 
  176.             return false; 
  177.         } 
  178.     } 
  179.      
  180.     for(i = 0; i < scheduleHotels.length; i++){ 
  181.         if(jQuery(scheduleHotels[i]).val().length > 100){ 
  182.             jQuery(scheduleHotels[i]).focus(); 
  183.             return false; 
  184.         } 
  185.     } 
  186.     return true; 
  187. }; 

 

附件:http://down.51cto.com/data/2358358

当前名称:jQuery插进tooltip提示和validate
浏览路径:http://cqcxhl.com/article/giccgg.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP