Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
55
rated 0 times [  56] [ 1]  / answers: 1 / hits: 22990  / 15 Years ago, tue, august 4, 2009, 12:00:00

I just wanna learn how to read Iframe content in onLoad event of iframe and write it's content to the main page ? Thanks..


More From » html

 Answers
9

I have struggled with same this past day. It seems to matter how you access the iframe. If you use document.getElementById() you get an Iframe object, which has no onload event. However, if you access through window.frames[] array, for example



var iframeWindow = top.frames['iframeID'],


you get a window object, which does have onload event.



(ie uses the frame id attribute , but ff uses name attribute. So use both and make the same)



You can then assign



iframeWindow.onload=function(){iframeContent=iframeWindow.document.body.innerHTML;};


Notice, since iframeWindow is a window object, you use window syntax to access content.


[#98990] Sunday, August 2, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jonrened

Total Points: 627
Total Questions: 114
Total Answers: 99

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
jonrened questions
Mon, Nov 2, 20, 00:00, 4 Years ago
Tue, May 19, 20, 00:00, 4 Years ago
Tue, Jan 21, 20, 00:00, 4 Years ago
Thu, Nov 7, 19, 00:00, 5 Years ago
;