IFRAME onLoad -- endless loop problem

T

Timo

I'd be grateful for some help with this weird problem.

My code seems to be stuck in an endless loop, with the IFRAME onLoad
eventhandler firing again and again. Whenever dynamic changes occur to
content in the page that hosts the IFRAME, the IFRAME's onLoad event appears
to fire. Is that by design? Under what conditions is an IFRAME's onLoad
event supposed to fire?

Background-- instead of XMLHTTP, I'm using an IFRAME to fetch data. A
function in the page that hosts the (invisible) IFRAME sets the IFRAME's
source URL, and when the IFRAME is finished loading, the IFRAME's onLoad
handler gets the IFRAME's innerHTML and inserts it into a DIV in the host
page.

Thanks
Timo

NOTE: In the following code, targetDIV is a handle to a DIV in the host
page.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<SCRIPT>

function setIframeUrl(url) {
if (document.layers && document.layers['RESULTSPANEL'].load ) {
document.layers['RESULTSPANEL'].load(url,0); }
else if (window.frames && window.frames.length ) {
window.frames['dataframe'].location.href = url;
}
}


function iframeXfer(myframe) {
var pnl;
if (document.getElementById)
pnl = myframe.document.getElementById('RESULTSPANEL');
else
pnl = myframe.window.document.all('RESULTSPANEL');

if (pnl) {
if (targetDIV) {
// if the next line is commented out, the endless-loop problem goes
away
targetExportCenter.insertAdjacentHTML("afterBegin",pnl.innerHTML);
// I plan to make this cross-browser when I solve this endless-loop
issue
}
}
}
</SCRIPT>
</HEAD>
<BODY>
<DIV id='myTargetDIV' >

</DIV>
<DIV id="RESULTSPANEL" style="DISPLAY: none; POSITION: absolute; TOP:
500px; HEIGHT: 0px">
<IFRAME id="DATAFRAME" name="dataframe"
src="about:blank" onLoad="iframeXfer(this)"></IFRAME>
</DIV>
</HTML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top