How to load one frame before another

T

torext

I have 3 frame (not frame set)
and I want to forse frame1 (where I define language for user) to be
load first, before any other frames. And if possible reload main page.
How should I do it from the main aspx page?
(ASP.NET)
thank you very...
 
T

Tim Streater

I have 3 frame (not frame set)
and I want to forse frame1 (where I define language for user) to be
load first, before any other frames. And if possible reload main page.
How should I do it from the main aspx page?
(ASP.NET)
thank you very...

I am not sure if you can control the loading of a frame, but when I had
a problem of using results of a frame before the frame actually loaded,
I set up a timer to prevent this.

In frame1, have a <body onload=first();> and in first() you set a flag
like below. My page took a long time to load because of doing much PHP
stuff there.

Then in the page where you want to delay the onload function, have its
onload function (say, loadPageB), look like below.

The way this works is that the timer is set up in loadTimerB and when it
expires 100msec later, loadTimer is called which checks the flag. If the
loading completed, it calls the onload function again, otherwise it
restarts the timer.

This worked well for me but I would be interested to see other
techniques.



function first ()
{

loadComplete = true;

}


function loadTimer ()
{

if (loadComplete==true)
{
loadFunction ();
return;
}

setTimeout ("loadTimer ()", 100);

}


function loadTimerB (loadFunc)
{

if (loadComplete==true)
{
return true;
}

loadFunction = loadFunc;

setTimeout ("loadTimer ()", 100);

return false;

}


function loadPageB ()
{

var result;

result = loadTimerB (loadPageB);
if (result==false)
{
return;
}

// real work to complete initialising this page done here

}

var loadComplete = false;
var loadFunction;

-- tim
 
C

Csaba Gabor

Tim said:
I am not sure if you can control the loading of a frame, but when I had
a problem of using results of a frame before the frame actually loaded,
I set up a timer to prevent this.

In frame1, have a <body onload=first();> and in first() you set a flag
like below.

This is good to here. By the time the onload fires, you know that
frame1 is safe. But I don't see the point of a timer. As I understood
the original poster, he wants to load the second page at this point
(and presumably they all have the same domain so no security issues).
Therefore, in first(), get a reference to the 2nd frame, and then set
the src for it (originally you give it a dummy src). The page for this
second frame similarly should have a <body onload=second();> in it to
load the third page.

Csaba Gabor from Vienna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,800
Messages
2,569,657
Members
45,415
Latest member
KarolDicke
Top