Release Iframe after response.rediect part 2

孤者浪人 提交于 2019-12-12 04:53:19

问题


I've messed up my main question so I here I go again.

I have a mainrecord.html that uses iframe to display 2 html - top and lower. On the top html page I have a save button. This save button does some data work and then goes to a different html. The problem is the lower iframe is still there. Here is what I have in the mainrecord.html:

<iframe scrolling="no" noresize target="middle" src="<%=JustPath(oProp.ScriptPath)+[/top.html?id=]+tmpid"%> name="top" height="62%" class="auto-style1" style="width: 100%">You need a Frames Capable browser to view this content.</iframe> 
<iframe scrolling="no" noresize target="middle" src="<%=JustPath(oProp.ScriptPath)+[/lower.html?id=]+tmpid"%>  name="lower" style="width: 100%; height: 35%">You need a Frames Capable browser to view this content.</iframe> 
<script type = "text/javascript" >
element = document.getElementById("lower");
</script>

In the top.html there is a save button that goes to a saverecord.html. I do some data work and then I do this:

<script type="text/javascript">

document.removeChild(element);

</script>
<%   oResponse.Redirect(JUSTPATH(oProp.ScriptPath)+[/viewrecords.html])%>

It correctly displays viewrecords.html. However, the iframe containing lower.html is still there.

Any suggestions?

TIA.


回答1:


You need to refer to a wrapping element in your JS to remove this Iframe.

<div class="frame2">
<iframe scrolling="no" noresize target="middle" src=""..."  name="lower" style="width: 100%; height: 35%">You need a Frames Capable browser to view this content.</iframe>
</div>

JS

element = document.getElementById("frame2"); <-- this is the wrapper for your Iframe
document.removeChild(element);


来源:https://stackoverflow.com/questions/9299542/release-iframe-after-response-rediect-part-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!