2016-01-13 177 views
0

嗨每一个现在我在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">&times;</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> 
+1

'removeIFrame();'是什么代码? – Hybrid

+0

我已将它重新加载到另一个页面需要天气吗? –

+0

对不起,我不知道是否需要或不第一次我在我的框架工作所以,你可以告诉我的代码删除IFrame –

回答

2

在你的页面中添加以下代码

<script> 
function removeIFrame(){ 
document.getElementById("templatesrc").remove(); 
} 
</script> 

这将彻底删除iframe中。

+0

可以请告诉我我应该把它放在哪里。首先我工作在iframe –

+0

我更新了我的答案。请检查 – Thanga

+0

是通过设置按钮的点击功能来尝试您的代码 –