common.js
/**
* 父画面锁定
*/
function lockParentWindow(){
var win = window.opener;
if (win) {
if (win.document.getElementById("mask")){
win.document.getElementById("mask").style.display = "";
}
}
}
/**
* 父画面解锁
*/
function unlockParentWindow(){
var win = window.opener;
if (win){
if (win.document.getElementById("mask")){
win.document.getElementById("mask").style.display = "none";
}
}
}
在父画面的html中,加入以下代码,
<div id="mask" style="position:absolute;z-index:100;width:100%;height:100%;background-color:black;filter:alpha(opacity=25);-moz-opacity:0.25;opacity:0.25;display:none;">
<iframe src="javascript:false" style="position:absolute;width:100%;height:100%;background-color:black;filter:alpha(opacity=0);-moz-opacity:0.0;opacity:0.0;"></iframe>
</div>
父画面和子画面加入 load,unload事件
<script type="text/javascript">
window.onload = function(){
lockParentWindow();
}
window.onunload = function(){
unlockParentWindow();
}
</script>
弹出pupup画面后,锁住父画面
最新推荐文章于 2023-03-11 21:17:11 发布