Forum Moderators: open
<head>
<script type="text/javascript">
function loadExternal(url) {
if ( window.frames['buffer'] ) {
window.frames['buffer'].location = url;
var lyr = document.getElementById? document.getElementById('display'): document.all? document.all['display']: null;
if ( lyr && typeof lyr.innerHTML!= "undefined" ) {
lyr.innerHTML = '<img src="/images/common/loading.gif" alt="">';
}
return false;
}
return true; // other browsers follow link
}// called when documents loaded into iframe (from their body's onload attribute)
function displayExternal() {
var lyr = document.getElementById? document.getElementById('display'): document.all? document.all['display']: null;
if ( window.frames['buffer'] && lyr && typeof lyr.innerHTML!= "undefined" ) {
lyr.innerHTML = window.frames['buffer'].document.body.innerHTML;
}
}
</script>
</head>
<body onload="loadExternal('file01.html')">
<div id="display"></div>
<!-- image placed here for preload (used in loadExternal function) -->
<iframe id="buffer" name="buffer" src="/images/common/loading.gif">Sorry, your browser does not support iframes.</iframe>
</body>
Now I have the need to use another iframe buffer on the same page, to display a second external page ---call it file02.html---.
Question: which is the most efficient way to do the job?
Thanks a lot for all the help you'll be able to give me.
function loadExternal(url, iframe_id) {
then change this:
var lyr = document.getElementById? document.getElementById('display'): document.all? document.all['display']: null;
to this:
var lyr = document.getElementById? document.getElementById(iframe_id): document.all? document.all[iframe_id]: null;
and this:
function displayExternal() {
var lyr = document.getElementById? document.getElementById('display'): document.all? document.all['display']: null;
to this:
function displayExternal(iframe_id) {
var lyr = document.getElementById? document.getElementById(iframe_id): document.all? document.all[iframe_id]: null;
and just put in the right iframe id on the function call