(function(){
var JHRZ_IMG_Arr = JHRZ_IMG_Arr || {};
JHRZ_IMG_Arr.loading = ["/static/images/loading.gif", "/static/images/loading_gray.gif"];
JHRZ_IMG_Arr.normal = ["/static/images/Normal.gif"];
window["JHRZ_IMG_Arr"]=JHRZ_IMG_Arr;
})();
/**
*获取url参数
*@name:获取的参数名
*/
function queryString(parameter) {
var reg = new RegExp("(^|&)" + parameter + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
/**
*打开模态窗口
*@url 地址
*@width 宽度
*@height 高度
*/
function showDialog(url, width, height) {
var win;
var x = parseInt(screen.width / 2.0) - (width / 2.0);
var y = parseInt(screen.height / 2.0) - (height / 2.0);
if (document.all) {
win = window.showModalDialog(url, window, "dialogWidth:" + width + "px; dialogHeight:" + height + "px; dialogLeft:" + x + "px; dialogTop:" + y + "px; status:no; directories:yes;scrollbars:no;Resizable=yes; ");
}
else {
win = window.open(url, "mcePopup", "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,modal=yes,width=" + width + ",height=" + height + ",resizable=no");
eval("try { win.resizeTo(width, height); } catch(e) { }");
win.focus();
}
return win;
}
/**
*加载等待提示
*@flag(true打开提示,false关闭提示)
*注意:需要将页面html,body的style中设置margin、padding为0,width、height为100%;
*/
(function (flag) {
window._loadarr=[];
//
var loading_div = function () { return document.getElementById("yeml_dlading") };
//创建loading层
var create_load_div = function () {
if (!loading_div()) {
var _div = document.createElement("div");
_div.setAttribute("id", "myloading_box");
_div.style.width = "100%";
_div.style.height = "100%";
_div.style.margin = "0px";
_div.style.padding = "0px";
var loading = "<div id='yeml_dlading' style='position:absolute;left:0;width:100%;height:100%;top:0;background:#FFFFFF;opacity:0.8;filter:alpha(opacity=90);z-index:9999999;'>";
loading += "<div style='background:transparent url(" + JHRZ_IMG_Arr.loading[1] + ") no-repeat scroll 10px 10px ;border:2px solid #B7CDFC;cursor:wait;position:relative;top:45%;margin:0 auto;width:200px;height:36px;line-height:36px;font-size:14px;text-indent:32px;'>";
loading += "正在加载,请等待......</div></div>";
_div.innerHTML = loading;
document.body.appendChild(_div);
window._loadarr.push(_div);
}
};
//移除loading层
var remove_load_div = function () {
if (loading_div()) {
document.body.removeChild(loading_div().parentNode);
}
};
//
function myLoading(flag) {
if (flag)
create_load_div();
else
remove_load_div();
}
window["myLoading"] = myLoading;
})();
/**将参数转换对象
*@url (a=1&b=2)
*return {a=1,b=2}
*/
function getQueryJson(url) {
var ret = {}; //Object
url.replace(/(\w+)=(\w+)/ig, function (a, b, c) { ret[b] = unescape(c); });
return ret;
}
/**
*封装jquery get请求ajax
*author:叶明龙
*time:2012-12-10
*/
function getAjax(url, para, fn) {
if (typeof fn == "function") {
if (para == undefined) {
para = {};
}
$.get(url, para, function (data) {
var obj = eval("(" + data + ")");
fn.call(this, obj);
})
}
}

2013-12-18补充

Array.prototype.max = function(){
return Math.max.apply({},this)
} Array.prototype.min = function(){
return Math.min.apply({},this)
}

jQuery easyui loading加载等待提示......

function ajaxLoading(){
$("<div class=\"datagrid-mask\"></div>").css({display:"block",width:"100%",height:$(window).height()}).appendTo("body");
$("<div class=\"datagrid-mask-msg\"></div>").html("正在处理,请稍候。。。").appendTo("body").css({display:"block",left:($(document.body).outerWidth(true) - 190) / 2,top:($(window).height() - 45) / 2});
}
function ajaxLoadEnd(){
$(".datagrid-mask").remove();
$(".datagrid-mask-msg").remove();
} //调用示例
$.ajax({
type: 'POST',
url: 'sendLettersAgain.action',
data: {id:obj.id},
beforeSend:ajaxLoading,\\发送请求前打开进度条
success: function(robj){
ajaxLoadEnd();\\任务执行成功,关闭进度条
}
});

自用封装javascript函数的更多相关文章

  1. 个人封装JavaScript函数

    function get_next_day(str_date){ var d=""; d=new Date(str_date); d.setDate(d.getDate()+1); ...

  2. 总结的一些封装好的javascript函数

    平时总结的一些常用javascript函数封装: //获取样式 function getStyle(obj,name){ if(obj.currentStyle){ return obj.curren ...

  3. ABP+AdminLTE+Bootstrap Table权限管理系统第七节--登录逻辑及abp封装的Javascript函数库

    经过前几节,我们已经解决数据库,模型,DTO,控制器和注入等问题.那么再来看一下登录逻辑.这里算是前面几节的一个初次试水. 首先我们数据库已经有的相应的数据. 模型和DTO已经建好,所以我们直接在服务 ...

  4. ABP+AdminLTE+Bootstrap Table权限管理系统第七节--登录逻辑及几种abp封装的Javascript函数库

    返回总目录:ABP+AdminLTE+Bootstrap Table权限管理系统一期         简介 经过前几节,我们已经解决数据库,模型,DTO,控制器和注入等问题.那么再来看一下登录逻辑.这 ...

  5. 原生javascript封装的函数

    1.javascript 加载的函数 window.onload = function(){} 2.封装的id函数 function $(id) { return document.getElemen ...

  6. Javascript作业—封装type函数,返回较详细的数据类型

    Javascript作业—封装type函数,返回较详细的数据类型 思路: 1 取typeof的值,如果是数字.函数等非对象类型,直接取类型 2 如果是object类型,则调用Object.protot ...

  7. JavaScript封装一个函数效果类似内置方法concat()

    JavaScript封装一个函数效果类似内置方法concat() 首先回忆concat()的作用: concat() 方法用于连接两个或多个数组.该方法不会改变现有的数组,而仅仅会返回被连接数组的一个 ...

  8. Javascript之封装运动函数

    @ 目录 阶段一.仅适用单位带px属性的匀速运动 阶段二.可适用单位不带px属性(如opacity)的匀速运动 阶段三.适用于多元素单一属性的匀速运动 阶段四.适用于多元素单一属性的匀速或缓冲运动 阶 ...

  9. ABP(现代ASP.NET样板开发框架)系列之21、ABP展现层——Javascript函数库

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之21.ABP展现层——Javascript函数库 ABP是“ASP.NET Boilerplate Project ...

随机推荐

  1. 1. MNIST读取数据

    %pylab inline Populating the interactive namespace from numpy and matplotlib 在Yann LeCun教授的网站中(http: ...

  2. luoguP3317 [SDOI2014]重建 变元矩阵树定理 + 概率

    首先,我们需要求的是 $$\sum\limits_{Tree} \prod\limits_{E \in Tree} E(u, v) \prod\limits_{E \notin Tree} (1 - ...

  3. [Codeforces 1060F] Shrinking Tree

    Link: 传送门 Solution: 原来CF的官方题解也能鸽啊…… 详细题解 该题思路: 1.对于每个点删边方案数为$fac[n-1]$,总贡献为每种方案下满足的概率的和,接下来直接求贡献 2.每 ...

  4. zoj 3261 逆向并查集+离线处理

    题意:给出一些点,每个点有权值,然后有一些边,相连.无向的.然后有一些操作 链接:点我 query a.表示从a出发的能到达的所有点权值最大的点的编号(相同取编号最小,而且权值要比自己大) desto ...

  5. Unity 的一些特性

    using System; using UnityEngine; using UnityEditor; using UnityEngine.Serialization; using Random = ...

  6. JSoup 用法详解

    清单 1 // 直接从字符串中输入 HTML 文档 String html = "<html><head><title> 开源中国社区 </titl ...

  7. SEPIC 单端初级电感转换器 稳压器 -- Zeta 转换器

    single ended primary inductor converter 单端初级电感转换器 SEPIC(single ended primary inductor converter) 是一种 ...

  8. Transistor latch improves on/off circuitry

    Figure 1 shows an example of on/off circuitry commonly used in battery-operated devices. The p-chann ...

  9. TSearch & TFileSearch Version 2.2 -Boyer-Moore-Horspool search algorithm

    unit Searches; (*-----------------------------------------------------------------------------* | Co ...

  10. Idea下Python开发平台的搭建

    1. python的下载 https://www.python.org/downloads/ 2. idea下python插件的安装 点击File->Settings...->Plugin ...