Hello Gib65,
If you don't or can't use the Ajax solution explained by John, you can use an elaborated version of what I proposed above. The onclick can be replaced by an onload. Scripts belonging to the external file (here: external.html) must be brought in separately (just as in the Ajax case). I tested it with all browsers. Seems to work well. With Google Chrome, it only works on the Internet (doesn't work when used locally).
Code:
<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<script>
function load_iframe(iframe_name,url)
{
frames[iframe_name].location.replace(url)
}
function iframecontent_to_div(div,iframe_name)
{
document.getElementById(div).innerHTML=frames[iframe_name].document.documentElement.innerHTML
}
function remove_iframecontent_from_div(div)
{
document.getElementById(div).innerHTML=''
}
</script>
<style>
.hidden_iframe{position: absolute; left:-10000px; display: none}
</style>
<body>
<!-- load the hidden iframe that is used for transferring content to a div -->
<a href="javascript: void(0)" onclick="load_iframe('external_content','external.html'); return false">load external</a>
<!-- Empty the div -->
<a href="javascript: void(0)" onclick="remove_iframecontent_from_div('mydiv'); return false">remove external</a>
<!-- when the iframe is fully loaded, its content will be transferred to the div thank to the 'onload' -->
<iframe name="external_content" src="about:blank" class="hidden_iframe" onload="iframecontent_to_div('mydiv','external_content')"></iframe>
<!-- The div into which the external content must be inserted -->
<div id="mydiv"></div>
</body>
</html>
Arie.
Bookmarks