您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
- <script type="text/javascript" src="<%=path%>/common/js/jquery.tipsy.js"></script>
- <script type="text/javascript" src="<%=path%>/common/js/jquery.validate.js"></script>
validate.js
- function AddAbroadTravel(){}
- $().ready(function() {
- $("#abroadtravelForm").validate({
- submitHandler:function(form){
- if(!AddAbroadTravel.validateSchedule()){
- return;
- }
- var form = document.getElementById("abroadtravelForm");
- form.encding="application/x-www-form-urlencoded";
- form.action = "/admin/abroadTravelAction!showAbroadTravel";
- form.target = "_self";
- form.submit();
- },
- rules: {
- "info.travelName": {
- required: true,
- minlength: 2,
- maxlength: 100
- },
- "info.travelDeparture": {
- required: true
- },
- "info.travelDestin": {
- required: true
- },
- "info.travelRoomUsers": {
- required: false,
- digits:true
- },
- "info.travelOnePersonRoom": {
- minlength: 0,
- maxlength: 100
- },
- "info.travelDiningViews": {
- required: false,
- minlength: 0,
- maxlength: 25
- },
- "info.travelHotel": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelTouristGuide": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelConditions": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelPeriod": {
- required: true,
- digits:true
- },
- "info.travelAccomCity": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelFuelCosts": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelLocalTax": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelAirportConstrFee": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelChildrenPrice": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelPoints": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelOtherOptions": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelNotes": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelCommitment": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelDepaTime": {
- required: true
- }
- }
- });
- var initTravelDeparture = jQuery("#initTravelDeparture").val();
- var initTravelDestin = jQuery("#initTravelDestin").val();
- if(!initTravelDeparture)
- initTravelDeparture = "";
- if(!initTravelDestin)
- initTravelDestin = "";
- linkage.init('travelDeparture_select_country','travelDeparture_select_city',initTravelDeparture);
- linkage.init('travelDestin_select_country','travelDestin_select_city',initTravelDestin);
- });
- //上传景点图片
- AddAbroadTravel.uploadImg = function(){
- var imgPath = jQuery("#upload").val();
- if(imgPath){
- var form = document.getElementById("abroadtravelForm");
- form.encding="multipart/form-data";
- form.action = "/admin/abroadTravelImgAction";
- form.target = "uploadImgFrame";
- form.submit();
- }
- };
- //删除景点图片
- AddAbroadTravel.delImg = function(imgA){
- jQuery(imgA.parentNode.parentNode).remove();
- };
- //追加日程
- AddAbroadTravel.addSchedule = function(){
- var imgsTables = document.getElementById("scheduleTable");
- var tr = imgsTables.insertRow(imgsTables.rows.length);
- var strHtml = '<td width="70px">第<input type="text" title="日程天数,正整数" id="scheduleDay" name="scheduleDay" maxlength="2" class="text_30" />';
- strHtml += '日</td><td align="right" width="70px">观光内容:</td><td width="222px">';
- strHtml += '<textarea class="textarea_300_50" style="width: 220px;" title="观光内容的介绍,0-250个字符" id="scheduleContent" name="scheduleContent"></textarea>';
- strHtml += ' </td><td align="right" width="70px">居住酒店:</td>';
- strHtml += ' <td><input type="text" id="scheduleHotels" title="居住的酒店名称,2-100个字符" name="scheduleHotels" maxlength="100" class="text_120" /> ';
- strHtml += '<a href="JavaScript:void(0)" onclick="AddAbroadTravel.delSchedule(this)">X</a></td>';
- tr.innerHTML = strHtml;
- jQuery('#div2 [title]').tipsy({trigger: 'focus',fade: true});
- };
- //删除日程
- AddAbroadTravel.delSchedule = function(obj){
- jQuery(obj.parentNode.parentNode).remove();
- };
- //验证日程
- AddAbroadTravel.validateSchedule = function(){
- var scheduleDays = jQuery("input[name='scheduleDay']");
- var scheduleContents = jQuery("textarea[name='scheduleContent']");
- var scheduleHotels = jQuery("input[name='scheduleHotels']");
- var i = 0;
- for(i = 0; i < scheduleDays.length; i++){
- if(!FM.STRING.isNum(jQuery(scheduleDays[i]).val())){
- jQuery(scheduleDays[i]).focus();
- return false;
- }
- }
- for(i = 0; i < scheduleContents.length; i++){
- if(jQuery(scheduleContents[i]).val().length > 250){
- jQuery(scheduleContents[i]).focus();
- return false;
- }
- }
- for(i = 0; i < scheduleHotels.length; i++){
- if(jQuery(scheduleHotels[i]).val().length > 100){
- jQuery(scheduleHotels[i]).focus();
- return false;
- }
- }
- return true;
- };
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。