html中
必须建遮罩div pop1,弹出div pop2
<div id="pop1" style="z-index:1;background-color:#00000000;filter:alpha(opacity=80);width:100%;height:100%;position:absolute;left:0px;top:0px;display:none">
</div>
<div id="pop2" style="z-index:2;background-image:url('./media/image/duang.gif');background-size:auto;filter:alpha(opacity=80);left:42%;top:30%;width:265px;height:110px;display:none;position:absolute;text-align: center;" >
</div>
点击按钮
<button class="btn red mini" style="margin-bottom: 6px;margin-right:15px;margin-top: 8px" οnclick="runFackMySQl()">
生成数据
</button>
js代码
//锁上
function show(o1,o2){
var o1 = document.getElementById(o1);
var o2 = document.getElementById(o2);
o1.style.width = document.documentElement.scrollWidth;
o1.style.height = document.documentElement.scrollHeight
o1.style.display = "block";
o2.style.display = "block";
}
//解锁
function close(o1,o2){
var o1 = document.getElementById(o1);
var o2 = document.getElementById(o2);
o1.style.width = document.documentElement.scrollWidth;
o1.style.height = document.documentElement.scrollHeight
o1.style.display = "none";
o2.style.display = "none";
}
//调用方法
function runFackMySQl() {
show('pop1','pop2');
//一些操作后
..............
.............
//执行解锁,,,
close('pop1','pop2');
}
第二种办法 利用jquery
function show(){
$("#pop1").show();
$("#pop2").show();
}
function close(){
$("#pop1").hide();
$("#pop2").hide();
}