html页面上嵌入的iframe,如何关闭?

父页面:

<div id="dep_select" onclick="$(this).css('display', 'none')" style="width: 100%; height: 100%; z-index: 1000; position:fixed; top: 0; left: 0; background:rgba(0,0,0,0.5); display: none;">
<iframe src="${ctx.contextPath}/strpubv2/dep_select.html" width="1250px" height="600px;" style="position:fixed;top:50%;left:50%;margin:-300px 0 0 -625px;z-index:1001;border: none;"></iframe>
</div>

在嵌入的iframe 页面中加上这样的JS代码即可

parent.document.getElementById("dep_select").style.display = "none";

posted @ 2016-11-25 16:47  晚`枫  阅读(2349)  评论(0编辑  收藏  举报