PDA

View Full Version : how to detect the page has finished loading?


lisa
22.05.2001, 12:57
would anyone know how to detect the page is finised loading form another frame?

i.e. I wanted to activate the function at one frame, only after the page in another frame is finished loading.

-- frame A calling function run()
-- only activate function run() when frame B finished loading its page.

Please post me a reply if you knwo the answer to this.

Many thanks

bratta
22.05.2001, 13:49
Can you have code inside the page loading in frame B?

If so you just place

onload="parent.frameA.run()"

inside the body tag of that page.

If you can't you have to do a LOT of workaround (like I did in the coolMenus), but it's possible...

-Thomas Brattli-
http://www.bratta.com/
http://www.dhtmlcentral.com/

lisa
22.05.2001, 14:53
well.. I need to run the function after page B is finished loading.

i.e.
Page A in Frame A running function show()
page B in Frame B
show() is to show layer in page B.
activate show() when the link in page A is mouseOver and mouseOut.

I need to run the show() function after page B is completly finished loading, otherwise it will throw me error in IE4 sometimes IE5.

therefore I want to know how I can detect a page is loading complete.

thanks
Lisa

bratta
22.05.2001, 15:36
Ok.

Then I assume you can add script to page B.

So it should be something like this:

in page A
<script>
var FRAME_B_LOADED=0

function show(){
if(FRAME_B_LOADED){

//YOUR CODE HERE

}
}
</script>

In page B:

<body onload="parent.FRAME_A_NAME.FRAME_B_LOADED=1">

Replace FRAME_A_NAME with the name of that frame (as spesified in the frameset).

Now, if you want to have different pages loading in the frame b you would just add this:

<body onload="parent.FRAME_A_NAME.FRAME_B_LOADED=1" onunload="parent.FRAME_A_NAME.FRAME_B_LOADED=0">

in all the pages.

So the show function will only try to manipulate the layer in FRAME B if the page in FRAME B has loaded.

Did that make sense?

-Thomas Brattli-
http://www.bratta.com/
http://www.dhtmlcentral.com/

lisa
23.05.2001, 07:39
the method almost works. Thanks Bratta

I just need to define the variable for the current page as well. otherwise it will throw an error saying FRAME_B_LOADED is undefine.

<body onload="parent.FRAME_A_NAME.FRAME_B_LOADED=1; FRAME_B_LOADED=1" onunload="parent.FRAME_A_NAME.FRAME_B_LOADED=0">


thanks again bratta