父页面
<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 页面加上
parent.document.getElementById("dep_select").style.display = "none";即可
本文介绍了一种在父页面中通过JavaScript控制子iframe显示与隐藏的方法。具体实现方式是在父页面使用JavaScript选择器获取到带有特定ID的div元素,并利用内联样式控制其显示状态。此外,还提供了一个在子iframe中触发父页面元素隐藏的示例。
2282

被折叠的 条评论
为什么被折叠?



