By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,729 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,729 IT Pros & Developers. It's quick & easy.

How to load one frame before another

P: n/a
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...

Nov 24 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <11**********************@g44g2000cwa.googlegroups .com>,
to****@mail.ru wrote:
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
Nov 24 '05 #2

P: n/a
Tim Streater wrote:
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

Nov 26 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.