var utils = { formatDate: function (data, format) { var o = { "M+": data.getMonth() + 1, // month "d+": data.getDate(), // day "h+": data.getHours(), // hour "m+": data.getMinutes(), // minute "s+": data.getSeconds(), // second "q+": Math.floor((data.getMonth() + 3) / 3), // quarter "S": data.getMilliseconds() // millisecond } if (/(y+)/.test(format)) { format = format.replace(RegExp.$1, (data.getFullYear() + "").substr(4 - RegExp.$1.length)); } for (var k in o) { if (new RegExp("(" + k + ")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); } } return format; } }; function TiggerMenu(obj) { if ($(obj).parent().find("dd").eq(0).css("display") == "none") { $(obj).parent().find("dd").show(); $(obj).parent().removeClass("closed"); $(obj).parent().addClass("extra"); //$(obj).addClass("menu_titlebottom"); } else { $(obj).parent().find("dd").hide(); $(obj).parent().removeClass("extra"); $(obj).parent().addClass("closed"); //$(obj).removeClass("menu_titlebottom"); } } function AddPageContent(id, pageNow, pageCount, url, Condition) { if (pageNow <= 0) pageNow = 1; if (pageNow > pageCount) pageNow = pageCount; var arrHtml = []; arrHtml.push("
"); arrHtml.push(""); var prevPage = pageNow - 1; var nextPage = pageNow + 1; if (pageNow != 1 && pageCount > 1) { //arrHtml.push(" 第一页"); arrHtml.push(" "); } if (pageCount > 0) arrHtml.push(" /"); if (pageNow < pageCount && pageCount != 1) { arrHtml.push(" "); //arrHtml.push(" 最后一页"); } if (pageCount > 1) { arrHtml.push(" 跳转 "); } arrHtml.push(""); arrHtml.push("
"); $("#" + id).html(arrHtml.join("")); } // 跳转 function MZGotoPage(obj, url, query) { var val = $.trim($(obj).prev().val()); if (val == "") { alert("请输入页码!"); return false; } if (!isNumber(val)) { alert("请输入有效页码!"); return false; } if (parseInt(val) > parseInt($(obj).next().val())) { alert("请输入有效页码!"); return false; } location.href = url + "?page=" + val + query; } //分页 function setPagination(id, currentPage, pageCount, query) { if (currentPage <= 0) currentPage = 1; if (currentPage > pageCount) currentPage = pageCount; var arrHtml = []; var pageStart = 1; var pageEnd = 5; if (currentPage == '' || currentPage < 1) currentPage = 1; if (currentPage > pageCount) { currentPage = pageCount; } pageStart = 1 * (currentPage - 1); pageStart = pageStart <= 1 ? 1 : pageStart; pageEnd = pageStart + 2; pageStart -= 2; pageEnd = pageStart <= 0 ? 5 : pageEnd; pageStart = pageStart <= 0 ? 1 : pageStart; pageEnd = pageEnd > pageCount ? pageCount : pageEnd; var prevPage = parseInt(currentPage) - 1; var nextPage = parseInt(currentPage) + 1; arrHtml.push(""); $("#" + id).html(arrHtml.join("")); } // 新的alert提示 start function msgBoxAlert(tip, i) { //var tip = ""; //switch (i) { // case 1: // tip = "服务器繁忙,请稍后再试。"; // break; // case 4: // tip = "设置成功!"; // break; // case 5: // tip = "数据拉取失败"; // break; // case 6: // tip = "正在加载中,请稍后..."; // break; //} ZENG.msgbox.show(tip, i); } function msgBoxHide() { ZENG.msgbox._hide(); } function msgBoxAlertAutohide(tip, i, time) { //var tip = ""; //switch (i) { // case 1: // tip = "服务器繁忙,请稍后再试。"; // break; // case 4: // tip = "设置成功!"; // break; // case 5: // tip = "数据拉取失败"; // break; // case 6: // tip = "正在加载中,请稍后..."; // break; //} ZENG.msgbox.show(tip, i, time); } // 新的alert提示 end var tempPublicVal_public = { maxzIndex: 9996, layerIndex: 1, wins: [] } function showDiv(idName) { var isExistLayer = false; for (var i = 0, len = tempPublicVal_public.wins.length; i < len; i++) { var winObj = tempPublicVal_public.wins[i]; if (winObj.popWin == idName) { var layerId = winObj.layer; var $layerIdObj = $("#" + layerId); if ($layerIdObj.length > 0) { if ($layerIdObj.is(":hidden") == true) { $layerIdObj.show(); } isExistLayer = true; return; } } } var isIE = (document.all) ? true : false; // var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6); var isIE6 = isIE && !window.XMLHttpRequest; var layerIndex = ++tempPublicVal_public.layerIndex var layerId = "layer" + layerIndex; var layerzIndex = ++tempPublicVal_public.maxzIndex; var layer = document.createElement("div"); layer.id = layerId; layer.style.width = layer.style.height = "100%"; layer.style.position = !isIE6 ? "fixed" : "absolute"; layer.style.top = layer.style.left = 0; layer.style.backgroundColor = "#000"; layer.style.zIndex = layerzIndex; layer.style.opacity = "0.6"; document.body.appendChild(layer); var divzIndex = ++tempPublicVal_public.maxzIndex; var newbox = document.getElementById(idName); newbox.style.zIndex = divzIndex; newbox.style.display = "block" newbox.style.position = !isIE6 ? "fixed" : "absolute"; newbox.style.top = newbox.style.left = "50%"; newbox.style.marginTop = -newbox.offsetHeight / 2 + "px"; newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px"; tempPublicVal_public.wins.push({ popWin: idName, layer: layerId, layerIndex: tempPublicVal_public.layerIndex }); // var sel = document.getElementsByTagName("select"); // for (var i = 0; i < sel.length; i++) { // sel[i].style.visibility = "hidden"; // } function layer_iestyle() { layer.style.width = Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth) + "px"; layer.style.height = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) + "px"; } // liehuo.net function newbox_iestyle() { newbox.style.marginTop = document.documentElement.scrollTop - newbox.offsetHeight / 2 + "px"; newbox.style.marginLeft = document.documentElement.scrollLeft - newbox.offsetWidth / 2 + "px"; } if (isIE) { layer.style.filter = "alpha(opacity=60)"; } if (isIE6) { layer_iestyle() newbox_iestyle(); window.attachEvent("onscroll", function () { newbox_iestyle(); }) window.attachEvent("onresize", layer_iestyle) } layer.onclick = function () { // newbox.style.display = "none"; layer.style.display = "none"; for (var i = 0; i < sel.length; i++) { // sel[i].style.visibility = "visible"; // } } } function hiddenDiv(idName) { window.onmousewheel = function () { return true }; var layerId = ''; for (var i = 0, len = tempPublicVal_public.wins.length; i < len; i++) { var winObj = tempPublicVal_public.wins[i]; if (winObj.popWin == idName) { layerId = winObj.layer; tempPublicVal_public.wins.splice(i, 1); break; } } $("#" + layerId).remove(); //$("#layer").hide(); $("#layer").remove(); $("#" + idName).hide(); } function ajaxRequest(url, jsonString, callback) { $.ajax({ type: "Post", contentType: "application/json", url: url, data: jsonString, dataType: 'json', success: function (result) { //回调函数,result,返回值 var err = ""; if (result.code != "0") { err = result.msg || "系统错误"; callback(err, result); return; } callback(null, result); }, error: function (XMLHttpRequest, textStatus, errorThrown) { callback(errorThrown, null); } }); } //手机号码验证信息 function isMobile(s) { var patrn = /^(13|14|15|17|16|18|19)\d{9}$/; if (!patrn.exec(s)) { return false; } return true; } function checkNum(val) { if (isNaN(val)) { return false; } return true; } function validNum(s) { var patrn = /^[0-9]+(.[0-9])*$/; if (!patrn.exec(s)) { return false; } return true; }