| Get Contents
Iframe Contents |
In the parent page:
<script type="text/javascript">
<!--
function get_contents(){
iframe_div=window.frames["iframe1_name"].document.body.innerHTML
document.getElementById("div_id").innerHTML=iframe_div
}
// -->
</script>
<iframe name="iframe_name" width="300" height="100" src="page.htm"></iframe>
<div id="div_id"></div>
<a href="#null" onclick="get_contents()">Get Contents</a>
If you are wanting to reference a specific element in the Iframe page use the following line in the function above
iframe_div=window.frames["iframe1_name"].document.getElementById("display").innerHTML
and put
<div id="display">Your Contents</div>
in the iframe page
You could also call the function in the parent page from the Iframe page by including
<script type="text/javascript">
<!--
function send_contents(){
parent.get_contents()
}
//Include onload="send_contents()" in the opening BODY tag
// -->
</script>