【jsp】利用js 弹出div 锁定屏幕

来源:互联网 发布:易烊千玺同款衣服淘宝 编辑:程序博客网 时间:2024/06/04 19:12
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" onclick="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.scrollHeighto1.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.scrollHeighto1.style.display = "none"; o2.style.display = "none"; }//调用方法function runFackMySQl() {    show('pop1','pop2');    //一些操作后    ..............    .............    //执行解锁,,,    close('pop1','pop2');}第二种办法 利用jqueryfunction show(){ $("#pop1").show();$("#pop2").show();}  function close(){ $("#pop1").hide();$("#pop2").hide();}  



0 0
原创粉丝点击