I have two iframes, iframe1 and iframe2. Iframe1 has 4 links. Now when I click on the last link, I have been able to close the iframe. But on closing it, I want iframe2 to be opened without any user-initiated action. How can I achieve this ?
This is the code that I have used for closing iframe1 and then i am trying to call iframe2 like this :
EDIT :
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();
}
Here the alert inside prepareFrame() is coming up but the modal is not .
Iframe1 is sourced from a parent jsp called myJSP.jsp, so when closed, I presume the control returns to that jsp. From there on, how can I open the new iframe automatically?
Kindly help.
Assume your iframe1 id is
dynamic_id1, iframe2 id isdynamic_id2and your functioncloseMyIframe()is inside iframe1 page.If so, just change your code line 4, from
to