Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Frame Loading

Status
Not open for further replies.

josh05

Programmer
Sep 13, 2001
4
US
Is there a way to run a function once a inset frame has loaded? The site loading in the frame cannot be edited. So the Onload cannot be added.
Thanks.
 
Assuming:

(1) iframe name is 'innerIframe'
(2) source HTML loaded into iframe has a close body tag (</BODY>)

...then call this function on the outer-doc's BODY tag's onload event:

Code:
<script>
var timeoutObject;
function checkIframe()
{
 //look for close-BODY tag in iframe HTML
 if (innerIframe.document.getElementsByTagName("HTML")[0].innerHTML.toUpperCase().indexOf("</BODY>") > -1) 
 {
  clearTimeout(timeoutObject);
  //whatever else you want to do
 }
 else
 {
  timeoutObject = setTimeout(checkIframe(), 100)
 }
}

I don't think this method is so great, but I think it should work.

'hope that helps.

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top