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

Update iframe after 2nd iframe loads

Status
Not open for further replies.

mwa

Programmer
Jul 12, 2002
507
US
I have an aspx page that contains 2 iframes that split the page horizontally. In the top iframe I load an aspx page that contains a "Please Wait" message. In the second iframe I load a aspx page that streams a pdf file. The pdf file takes 10 - 20 seconds to load. Once it is done loading, I would like to change the src of the top iframe so that the message changes to "Done". Is there a way to change the src of one iframe based upon the complete loading of a second iframe?

Thanks in advance...

mwa
<><
 
Why don't you make the Please Wait message an image... and change the image to an image of "Done" when it is complete?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- The Complete IT Community
 
That would be fine too... But how do I know when it is done? is there a way from iframe1 to check the load status of iframe2? Or from the parent page to check the status of iframe2 and update iframe1?

mwa
<><
 
But then I can't show the "Please Wait" message AND stream the pdf...

To my understanding, once the content type of the page has been set, you can not change it to something else. So in other words the Content type of the page to show the message would be HTML. But then in order to stream the pdf, the content type would need to be pdf. So eliminating the iframe would do me no good. I would be trying to send 2 different content types to 1 aspx page.

mwa
<><
 
I figured out how to do this for future reference:

Build the 2 iFrames in the container page:
Code:
		<IFRAME id="iMessage" SRC="[URL unfurl="true"]http://localhost/myApp/PleaseWait.aspx"[/URL] WIDTH=100% HEIGHT=25% frameborder=no></IFRAME>
		<IFRAME id="iPdf" SRC="[URL unfurl="true"]http://localhost/myApp/ViewPDF.aspx"[/URL] WIDTH=100% frameborder=no></IFRAME>

Add a chunk of javascript code to the main container page:

Code:
    <script language="javascript">
		function iframeLoaded()
			{
			document.all.iMessage.style.visibility="hidden";
			document.all.iMessage.height="0";
			document.all.iPdf.height="100%";
			}
    </script>

Call this function on the onload of the container page.
Code:
<body MS_POSITIONING="GridLayout" onload="iframeLoaded()">

It works perfectly.

mwa
<><
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top