我有两个 iframe,iframe1 和 iframe2。iframe1 有 4 个链接。现在,当我单击最后一个链接时,我已经能够关闭 iframe。但是在关闭它时,我希望在没有任何用户启动操作的情况下打开 iframe2。我怎样才能做到这一点?
这是我用来关闭 iframe1 的代码,然后我试图像这样调用 iframe2:
编辑 :
function prepareFrame() {
alert("Inside prepare frame");
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", "openThis.jsp");
ifrm.style.width = 640+"px";
ifrm.style.height = 480+"px";
document.body.appendChild(ifrm);
}
function closeMyIframe() {
var parentDynamicDiv = window.parent.document.getElementById('dynamic_id1');
var iframe = window.parent.document.getElementById('dynamic_id2');
iframe.style.display = 'none';
parentDynamicDiv.style.display = 'none';
prepareFrame();
}
此处 prepareFrame() 中的警报即将出现,但模式未出现。
iframe1 来源于一个名为 myJSP.jsp 的父 jsp,所以当关闭时,我认为控件返回到该 jsp。从那里开始,我怎样才能自动打开新的 iframe?
请帮忙。