I have a code which displays a hidden div on the screen.
* I make that div visible.
* I add an iframe to that div using innerHTML =
Here is the flow:
* User performs an action and an IFrame appears on the screen.
* The user performs a second action and the IFrame dissapears.
I must use an IFrame, because the content that will be displayed in the IFrame is large and I don't want to load it if it will not be needed (the user will not click the link). I use the IFrame to load it on demand.
How can I send a valid reference of the original page to the target page that gets loaded in the IFrame?
If I understand you correctly, you are still in the same window and you wish to remove the I-Frame from the div tag? Rather than actually removing the I-Frame from the div tag, I would dynamically set the "src" attribute of the I-Frame within the div tag instead of inserting and removing the I-Frame alltogether. Then all you need to do is make the div's style tag "display:none" or "display:block" depending on the functionallity requested.
However, if you are refering to a different calling window, you may want to check out the window.opener properties such as one that I am using on a page of mine: "opener.location.reload(true);" This reloads the parent window from the child.
Once I load a page inside an IFrame, I am using that page for reference. That means that I am not longer in the original page.
I need the ID of the original page to the page that is loaded in the IFrame.
Once I have the ID (or some other way to refer to the original page), then I can refer to any of the DIV elements in it from the page in the IFrame
You may need to wrap the div tag in a form so that you can reference it from the I-Frame page something like below: