www.gusucode.com > 艺帆全站DIV+CSS体育用品公司网站源码 1.7.5源码程序 > skins/js/lib.system.js
/** * SelectUI - jQuery pligin * By Alan * www.freecontex.com */ (function($){$.fn.selectui = function() { this.find('.selectui').each(function(index) { var z = 999-index; var ui = $(this), face = ui.find('.face,.face01'), list = ui.find('ul'); ui.css('z-index', z); face.blur(function(){setTimeout(function(){list.slideUp(100);},100);}) .click(function(){list.slideToggle(100);}); list.find('a').click(function() { var opti = $(this); face.val(opti.text()); ui.find(':hidden').val(opti.attr('value')); return false; }); }); }})(jQuery); //显示loading function loading (status, content, times, callback){ times = times ? times : 1500; html = '<div id="loadingmark"></div><div id="loading">'+content+'</div>'; if (window.seconds) window.clearTimeout(window.seconds); window.seconds = null; window.loadingshow = function(){ window.top.$('#loading').fadeIn(100); window.top.$('#loadingmark').fadeIn(0); }; window.loadinghide = function(){ window.top.$('#loading').fadeOut(100, function(){ if (callback){ if (typeof callback == 'string'){ try {eval(callback)} catch (e){}; } else if (typeof callback == 'function') callback(); } }); window.top.$('#loadingmark').fadeOut(0); }; var loading = window.top.document.getElementById('loading'); if (loading){ window.top.$('#loading').html(content); loadingshow(); } else { window.top.$('body').append(html); loadingshow(); } if (status != false){ window.seconds = window.setTimeout(function(){ loadinghide(); },times); } } //异步POST请求 function Post (url, data, message, callback){ $.ajax ({ type : 'post', url : url, cache : false, dataType : 'text', data : data.serialize(), timeout : 20000, beforeSend : function(XMLHttpRequest){ loading(false, 'Loading...'); }, success: function(text){ var arr = text ? text.split('|') : ['无效的服务器响应。']; if (arr[0] == 'YES'){ message[2] = message[2] ? message[2] : 0; loading(true, arr[1], message[1], callback); } else if (arr[0] == 'ERR'){ Boxy.ask(arr[1], ["确定"], function(val){ loadinghide(); try {if (arr[2]) document.getElementById(arr[2]).focus();} catch (e){}; }, {title: "提示信息"}); } else { Boxy.ask(arr[0], ["确定"], function(val){ loadinghide(); }, {title: "提示信息"}); } }, error: function(XMLHttpRequest, textStatus, errorThrown){ Boxy.ask('Error', ["确定"], function(val){ loadinghide(); }, {title: "提示信息"}); } }); } (function($){$.fn.cen = function(x){ this.click(function(){ var height = -($(x).height() / 2 | 0); $(x).css({'top': '50%', 'margin-top': height+'px'}); $(x).fadeIn(600); }); $(x).find('h2 span').click(function(){ $(x).fadeOut(300); }); }})(jQuery);