How to control order of frames loading?

C

CharlesEF

Hi All,

I have an HTA with 3 frames. In the main frameset HTML, the very
first frameset, I have an onload function. This frameset function
MUST execute before any of the 3 frames are loaded because it sets
global variables to be used among the 3 frames.

During all my tests it seems that the frame page is loaded before the
frameset onload function has executed.

Is there any way to insure that the frameset onload function has
completed before the frame pages are loaded?


Thanks for any help,

Charles
 
T

Thomas 'PointedEars' Lahn

CharlesEF said:
I have an HTA with 3 frames. In the main frameset HTML, the very
first frameset, I have an onload function. This frameset function

As in ` said:
MUST execute before any of the 3 frames are loaded because it sets
global variables to be used among the 3 frames.

Unless you mean "initialize" or "modify" by "set", a function can _not_
"set" global variables. It could set (add/modify) globally available
properties, if that; but you really want to declare your variables in the
global execution context.
During all my tests it seems that the frame page is loaded before the
frameset onload function has executed.

Is there any way to insure that the frameset onload function has
completed before the frame pages are loaded?

No, for it is specified that a `load' listener of an element is called
*after* all its sub-items have been loaded (whereas there is uncertainty
what "loaded" means in this context).¹

However, as the HTML 4.01 Frameset DTD allows a HEAD element², you could,
if your variable initialization would not rely on the DOM too much (which
tends to works asynchronously) or at all, use a SCRIPT element to
*actually* declare global variables.

....
<head>
...

<script type="text/javascript">
var answer = 42;
</script>
</head>

<frameset ...>
...
</frameset>
....


PointedEars
___________
¹ <http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-
eventgroupings-htmlevents>
² <http://www.w3.org/TR/html401/sgml/framesetdtd.html>
 
C

CharlesEF

Hi All,

I have an HTA with 3 frames.  In the main frameset HTML, the very
first frameset,  I have an onload function.  This frameset function
MUST execute before any of the 3 frames are loaded because it sets
global variables to be used among the 3 frames.

During all my tests it seems that the frame page is loaded before the
frameset onload function has executed.

Is there any way to insure that the frameset onload function has
completed before the frame pages are loaded?

Thanks for any help,

Charles

Hi All,

No need to help with this problem. I was over thinking the problem.
There is no need to control the order the frames load. After giving
up for the night I posted this plea for help and watched a DVD. After
the movie was over the solution hit me, turns out to be very simple
fix. I removed the onload function call from the frameset and move
the function call to a script block. This way the global variables
are set before the frameset even loads.


Thanks for looking,

Charles
 
C

CharlesEF

Unless you mean "initialize" or "modify" by "set", a function can _not_
"set" global variables.  It could set (add/modify) globally available
properties, if that; but you really want to declare your variables in the
global execution context.



No, for it is specified that a `load' listener of an element is called
*after* all its sub-items have been loaded (whereas there is uncertainty
what "loaded" means in this context).¹

However, as the HTML 4.01 Frameset DTD allows a HEAD element², you could,
if your variable initialization would not rely on the DOM too much (which
tends to works asynchronously) or at all, use a SCRIPT element to
*actually* declare global variables.

...
  <head>
    ...

    <script type="text/javascript">
      var answer = 42;
    </script>
  </head>

  <frameset ...>
    ...
  </frameset>
...

PointedEars
___________
¹  <http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-
eventgroupings-htmlevents>
²  <http://www.w3.org/TR/html401/sgml/framesetdtd.html>

Hi PointedEars,

I did not see this message when I just posted my solution to my
problem. I already did what you suggest and it works great.


Thanks for the help,

Charles
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top