//================================================== // // we.js - wdb 系統函數 // // 版權所有 Copyright (C) 2005/09/11 亞路科技股份有限公司 許世衛 http://talk.away.com.tw/ // // 未經書面許可,嚴禁發佈、複製、編輯、傳輸、展示及使用。 // // 原創作者: 許世衛 smhsw aWay // var caseXmlTag = 1; // 0:大小寫不變 1:小寫字母 2:大寫字母 var isCompactXML = 0; // 0:完整XML 1:精簡XML 2:絕對精簡XML str2htmlAy = new Array ( ["&", "#amp;"], ["#amp;", "&"], ["<", "<"], [">", ">"], [" ", " "] ); isIE = (document.all) ? 1 : 0; isIE6 = (isIE) ? ((navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1) ? 1 : 0) : 0; isIE7 = (isIE) ? ((navigator.userAgent.toLowerCase().indexOf('msie 7')!=-1) ? 1 : 0) : 0; isFF2 = (isIE) ? 0 : ((navigator.userAgent.toLowerCase().indexOf('firefox/2')!=-1) ? 1 : 0); isFF3 = (isIE) ? 0 : ((navigator.userAgent.toLowerCase().indexOf('firefox/3')!=-1) ? 1 : 0); //================================================== // 計算 em 之下的 childNodes 中,有多少個 _xmlType 是 block。 // 可以用 _xmlBGID 區分不同的 block group。 // window.CountChildBlock_ = function (em, xmlBGID) { // function begin var childAy = em.childNodes, n = 0; for (var i=0; i=0) { ss = ss.split(s1); ss = ss.join(s2); } return ss; } // function end //================================================== // 將 \r\n 轉為 // // window.trimCRLF_ = function (s) { // function begin s = strReplace_(s, '\r', ''); s = strReplace_(s, '\n', ''); // s = strReplace_(s, '\n', ''); return s; } // function end //================================================== // 將字串轉換 str2htmlAy 所列的特殊字元為 html code。 // window.str2html_ = function (s) { // function begin s = strReplace_(s, "\r", ""); var a = s.split('\n'); var n = a.length, c = ''; var sAy = new Array(); var isCode = 0; var isTable = 0; s = ""; for (var i=0; i=0) isTable = 1; // if (s.indexOf('')>=0) isTable = 0; if (s=='[code]') isCode = 1; if (s=='[/code]') isCode = 0; if (isCode) s = strReplace_(s, '<', '<'); c = a[i].charAt(a[i].length-1); if (!isTable) if (i < n-1) if (c == '+') s += "''+"; else if (c == ';' || c == '{' ||c == '}') s += ';;'; else if (c == '>') if (a[i].indexOf(' window.iframeReheight_ = function (id, minh) { // function begin if (typeof(id)=='undefined') id = 'iframeReheight'; if (!document.getElementById(id)) return; var doc = getIFrameDocument_(id); if (!doc) return; var info = getScrollInfo_(doc); if (!info) return; if (!info.height || info.height==0) return; iframeSetheight_(info.height, id, minh); setTimeout('iframeReheight_("'+id+'", '+minh+')', 2000); } // function end window.iframeSetheight_ = function (h, id, minh) { // function begin if (h < 0) return; if (typeof(id)=='undefined') id = 'iframeReheight'; if (typeof(minh)=='undefined') minh = 0; if (h < minh) h = minh; if (document.getElementById(id)) document.getElementById(id).style.height = h+'px'; } // function end //================================================== // 針對非 FireFox3 的 browser,將 input 的 size -1 // window.adjInputSize_ = function () { // function begin $('input , select , textarea').each(function(){ sAy = new Array(); s = $(this).prop('title'); if (typeof(s)!='undefined' && s!='') sAy[sAy.length] = s; s = $(this).attr('_xmlTag'); if (typeof(s)!='undefined' && s!='') sAy[sAy.length] = (s.toLowerCase()=='value') ? $(this).prop('name') : s; s = $(this).attr('_idxName'); if (typeof(s)!='undefined' && s!='') sAy[sAy.length] = s; s = $(this).attr('_idxNameRO'); if (typeof(s)!='undefined' && s!='') sAy[sAy.length] = s; s = $(this).attr('_idxNameRW'); if (typeof(s)!='undefined' && s!='') sAy[sAy.length] = s; if (sAy.length) $(this).prop('title', sAy.join(' ; ')); }); } // function end //================================================== // 設定 input value 設定 radio 的 checked // window.setRadioChecked_ = function (em) { // function begin var xmlTag = em.getAttribute("_xmlTag"); if (document.getElementById(xmlTag+"_"+em.value)) document.getElementById(xmlTag+"_"+em.value).checked = true; else if (document.getElementById(xmlTag+"_---")) document.getElementById(xmlTag+"_---").checked = true; } // function end window.setRadioValue_ = function (em) { // function begin var xmlTag = em.name; document.getElementById(xmlTag).value = em.value; } // function end //================================================== // 設定 Table 奇偶行背景色 // idTable=Table ID, cOdd="奇數背景", cEven="偶數行背景", cOver="滑鼠經過背景", cClick="滑鼠點擊後背景" // window.setTrBgColor_ = function (idTable, cOdd, cEven, cOver, cClick) { // function begin if (typeof(idTable)=='string') idTable = document.getElementById(idTable); var t = idTable.getElementsByTagName("tr"), c = '', n = -1; for (var i=0; i 筆 : 頁數 '; var p0 = json.pn - 4; if (p0 < 1) p0 = 1; if (p0 > 1) s[i++] = ' 1 '; if (p0 > 2) s[i++] = '..'; for (var j=p0; j<=p0+9; j++) if (j <= json.pageCount) if (j==json.pn) s[i++] = ' '; else s[i++] = ' '+j+' '; if (p0+9 < json.pageCount-1) s[i++] = '..'; if (p0+9 < json.pageCount) s[i++] = ' '+json.pageCount+' '; s[i++] = ' : 每頁筆 : '; if (json.pn > 1) s[i++] = ' 上一頁 '; if (json.pn < json.pageCount) s[i++] = ' 下一頁 '; return s.join(''); } // function end //================================================== // 顯示快閃訊息 window.msg_ = function (msg, sec, pos, css) { // function begin if (typeof(msg)=='undefined') msg = 'Hello! 你好!'; if (typeof(sec)=='undefined') sec = 4000; if (typeof(pos)=='undefined') pos = 'top'; if (typeof(css)=='undefined') css = ''; var html = '
'+msg+'
'; $('body').append(html); setTimeout(function(){ $('.divFlashMsg').fadeOut(function(){ $(this).remove(); }); }, sec); } // function end //================================================== // PagePanel ctrl window.PagePanelHide_ = function() { $('.cssPagePanel , .btnPagePanel').hide(); } window.PagePanelShow_ = function() { $('.cssPagePanel , .btnPagePanel').show(); }