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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the onload event of an iframe

Status
Not open for further replies.

Aarem

Programmer
Oct 11, 2004
69
US
Hello everyone.

For some strange reason, whenever I try to get the onload event of any iframe in an HTA, I get "null" as a response. I've tried altering everything I can think of, but nothing has worked!

Any ideas on how to fix this?

Code:
<iframe src="[URL unfurl="true"]http://google.com"[/URL] application=yes onload="alert()"></iframe>

<script>
function doit()
{
alert(window.frames[0].onload)
}
</script>

<button onclick="doit()">blah</button>
 
Yes, however, it isn't just one time I need to access it. At one point in the script, I need to actually change the onload event. I tried this by even writing another iframe with an onload event of alert() and even the document.body.innerHTML showed it printed, but the frame apparently never loaded, even after about 18 minutes.
 
Maybe we have a misunderstanding of terminology. This is what I mean:

MAIN.HTM
Code:
<html><body>
<iframe src="onloadtest.htm" 
 frameborder="1" height="100px" width="200"></iframe>
</body></html>

ONLOADTEST.HTM
Code:
<html>
<body onload="alert('viewed in an iframe')">
I am a frame.
</body></html>

Clive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top