/// <reference path="/scripts/js/jquery.min.js" />
var zsw = {
loading: function (imgUrl, content, width) {
if (content == "" || content == undefined || content == null) {
content = "正在加载中";
}
if (width == "" || width == undefined || width == null) {
width = 250;
}
var h = '<div id="zswloading" style="background:url(' + imgUrl + ') no-repeat 50% 30%; position:fixed; min-width:100px; background-color:#fff; min-height:100px; width:' + width + 'px; height:' + width + 'px; border:2px solid #eee; top:0px; bottom:0px; left:0; right:0; margin:auto;box-shadow:0 0 40px #767373;-moz-box-shadow:0 0 40px #767373;-webkit-box-shadow:0 0 40px #767373; border-radius:50%;"> <div style=" text-align:center; color:#808080; margin-top:70%;">' + content + '...</div> </div>';
$("body").append(h);
},
closeloading: function () {
$("#zswloading").remove();
}
}
javascript如上,调用如下
<a href="javascript:void(0)" onclick="zsw.loading('loading.gif','正在处理',200)">打开</a>
<a href="javascript:void(0)" onclick="zsw.closeloading()">关闭</a>
依赖jquery