您好,登錄后才能下訂單哦!
- <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);
- });
- //上傳景點(diǎn)圖片
- 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();
- }
- };
- //刪除景點(diǎn)圖片
- 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="日程天數(shù),正整數(shù)" id="scheduleDay" name="scheduleDay" maxlength="2" class="text_30" />';
- strHtml += '日</td><td align="right" width="70px">觀光內(nèi)容:</td><td width="222px">';
- strHtml += '<textarea class="textarea_300_50" style="width: 220px;" title="觀光內(nèi)容的介紹,0-250個(gè)字符" id="scheduleContent" name="scheduleContent"></textarea>';
- strHtml += ' </td><td align="right" width="70px">居住酒店:</td>';
- strHtml += ' <td><input type="text" id="scheduleHotels" title="居住的酒店名稱,2-100個(gè)字符" 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();
- };
- //驗(yàn)證日程
- 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;
- };
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。