如何关闭iframe窗口?
问题描述:
嗨每一个现在我在iframe上工作的问题是iframe不完全关闭,而重新加载页面iframe在后台运行,我无法访问页面重新加载后,因为iframe按钮,使我访问该页面时遇到麻烦。如何关闭iframe窗口?
我附上了我的iframe代码,下面提示我可能的解决方案。
<div class="top" onclick="removeIFrame();"></div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">New Message</h4>
</div>
<div class="modal-body">
<iframe id="templatesrc" name="templatesrc" src="?do=manualupgrade&id=<AJDF:output>$smarty.get.id</AJDF:output>" width="690" height="400" frameborder="0"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
答
在你的页面中添加以下代码
<script>
function removeIFrame(){
document.getElementById("templatesrc").remove();
}
</script>
这将彻底删除iframe中。
'removeIFrame();'是什么代码? – Hybrid
我已将它重新加载到另一个页面需要天气吗? –
对不起,我不知道是否需要或不第一次我在我的框架工作所以,你可以告诉我的代码删除IFrame –