send a variable value from an Iframe back to its parent
document.write and innerhtml both the functions are useful to adding the dynamic content in in Document.
So We need understand the similarities and differences and limitation about document.write and innerhtml.
First whenever and where you calls document.write function that more important.
Here I am going to show you how to use the document.write first.
Using above code you can print or execute the so much HTML content in DOM.
Here I am going to show you how to use the innerHTML in DOM.
Note: In your document “sample_Div” id with div need to be present.
put following code in your document.
<div id=\"sample_Div\"> Sample Text </div>
Loading iframe using innerhtml is the best techniqe and solution for web services and cross domain calls.
document.getElementById('sample_Div').innerHTML = "<iframe src='http://images.wordpressapi.com/'></iframe>";
Both the techniques are stand for as per situation and use