$(document).ready(function(){ hMenuMobileSetUp(); }); //手機選單功能 function hMenuMobileSetUp(){ $('.h_menu_m').on( 'click', function(){ hMenuMobileSwitch(); }); $(window).resize(function(){ if('none'==$('.h_menu_m').css('display')) hMenuMobileSwitch(false); }); } //手機選單收合 function hMenuMobileSwitch( showType ){ var showNow=showType; if( null==showType ){ 'auto' != $('.h_menu_mobile').css('overflow') ? showNow=true : showNow=false; } if( showNow ){ $('body').css('overflow', 'hidden'); $('.h_menu_mobile').css('overflow', 'auto').css('display', 'block'); }else{ $('body').css('overflow', ''); $('.h_menu_mobile').css('overflow', '').css('display', ''); } } //取得鄉鎮市區 function changeAreaCantonForAjax(cityName,cantonName){ var cityId = document.getElementById(cityName).value; $.ajax({ type: "GET", url: "ajax/ajax_area_canton.php?PHPSESSID=00261ff9c28d34f40fbff4ecbcdcbd51", data: { 'cityId': cityId }, dataType: "json", cache: false, success: function(data) { var courseObj = document.getElementById(cantonName); //Remove目前選擇的鄉鎮市區選單內容 $("#"+cantonName+" option").remove(); courseObj.options.length = 0; courseObj.options[0] = new Option ("請選擇",""); for (var i = 0; i < data.length; i++) { courseObj.options[(i+1)] = new Option (data[i]['name'],data[i]['id']); } } }); } function changeAreaCantonForAjaxTwo(cityName,cantonName,cantonId){ var cityId = document.getElementById(cityName).value; $.ajax({ type: "GET", url: "ajax/ajax_area_canton.php?PHPSESSID=00261ff9c28d34f40fbff4ecbcdcbd51", data: { 'cityId': cityId }, dataType: "json", cache: false, success: function(data) { var courseObj = document.getElementById(cantonName); //Remove目前選擇的鄉鎮市區選單內容 $("#"+cantonName+" option").remove(); courseObj.options.length = 0; courseObj.options[0] = new Option ("請選擇",""); for (var i = 0; i < data.length; i++) { courseObj.options[(i+1)] = new Option (data[i]['name'],data[i]['id']); } $("#"+cantonName).val(cantonId); } }); } //取得郵遞區號 function changeAreaCantonZipForAjax(cantonName,zipName){ var cantonId = document.getElementById(cantonName).value; $.ajax({ type: "GET", url: "ajax/ajax_area_zip.php?PHPSESSID=00261ff9c28d34f40fbff4ecbcdcbd51", data: { 'cantonId': cantonId }, dataType: "json", cache: false, success: function(data) { //將郵遞區號回填至表單中 $("#"+zipName).val(data); } }); } //重新取得驗證碼 function reSIImage(){ var d1 = new Date(); var when=d1.getTime(); document.getElementById('siimage').src = "system_info/plugin/securimage/securimage_join_show.php?sid="+when; } //去除左空格 function LTrim(str) { return str.replace(/^[ \t\n\r]+/g, ""); } //去除左空格 function RTrim(str) { return str.replace(/[ \t\n\r]+$/g, ""); } //去除前後空格 function Trim(str){ return RTrim(LTrim(str)); } //確認是否為數值 function checkNumber(number) { a = number; date = a.match(/[^0-9]/g); if(date || !a){ return false; }else{ return true; } } //確認是否為Email function checkEmail(strEmail) { emailRule = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]+$/; if(strEmail.search(emailRule)!= -1){ return true; }else{ return false; } } //確認聯絡電話(市話) function checkTel(strTel){ if (strTel.search(/^[0][1-9]{1,1}-([0-9]{5,8})+((#([0-9]){1,5}){0,1})$/)!=-1) { return true; }else { return false; } } //確認手機號碼 function checkMobile(strMobile){ if (strMobile.search(/^09[0-9]{8}$/)!=-1) { return true; }else { return false; } } //頁面重新reload function reloadRePage() { window.location.reload(); } function openFancyboxByCloseClickFalse(url,width,height){ $.fancybox({ autoSize : false, padding : 0, margin : 0, scrolling : 'no', title : this.title, width : parseInt(width,10), height : parseInt(height,10), href : url, type : 'iframe' , 'closeBtn' : false, helpers : { overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox } }); return false; } //這個是給 onlinie_project.php 用的 為了多代一個參數 function openFancyboxByCloseClickFalse2(url,width,height,str){ $.fancybox({ autoSize : false, padding : 0, margin : 0, scrolling : 'no', title : this.title, width : parseInt(width,10), height : parseInt(height,10), href : url+'&str='+str, type : 'iframe' , 'closeBtn' : false, helpers : { overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox } }); return false; } //開光箱但背景不能點,能點選Close Button function openFancyboxByCloseClickTure(url,width,height){ $.fancybox({ autoSize : false, padding : 0, margin : 0, scrolling : 'no', title : this.title, width : parseInt(width,10), height : parseInt(height,10), href : url, type : 'iframe' , 'closeBtn' : true, helpers : { overlay : {closeClick: true} // prevents closing when clicking OUTSIDE fancybox } }); return false; }