// 查询内容为空是提示内容 function NoContent() { this.cont = $('body'); // 容器 this.ht = $(document).height(); // 容器的高度 this.wd = $(document).width(); // 容器的宽度 } NoContent.prototype.showNoContent = function(str, fadeout) { this.ht = $(document).height(); // 容器的高度 this.wd = $(document).width(); // 容器的宽度 if(str == undefined) { str = '暂无查询数据!'; } this.cont.css('position', 'relative'); var noCont = $('
'); // 提示框的容器 var noContHd = $('
'); // 提示框的头部 var noContTxt = $('
'); // 提示框的内容 // 给提示框的头部添加信息 var hdSpan = $('系统提示'); var out = $('关闭'); noContHd.append(out); noContHd.append(hdSpan); // 给提示框添加内容 var txt = $('
'+str+'
'); noContTxt.append(txt); // 创建遮罩层 var mask = $('
'); mask.css({ 'position': 'fixed', 'top': 0, 'left': 0, 'z-index': '999998', 'width': '100%', 'height': this.ht+'px', 'background-color': '#000', 'filter':'alpha(opacity=10)', /*IE滤镜,透明度50%*/ '-moz-opacity':0.1, /*Firefox私有,透明度50%*/ 'opacity':0.1 /*其他,透明度50%*/ }); this.cont.append(mask); noCont.append(noContHd); noCont.append(noContTxt); this.cont.append(noCont); noCont.draggable(); // 依赖于jquery-ui.js var _this = this; if(fadeout) { setTimeout(_this.hideNoContent.bind(_this), 2000); } }; NoContent.prototype.hideNoContent = function(container) { if(container != undefined) { this.cont = container; // 重新定义容器 } this.cont.find('.no-cont').remove(); this.cont.find('.no-cont-mask').remove(); }; var noContent = new NoContent();