function execution sequence problem

P

Paul

The problem I am having involves the sequence of events between frames in an

html page.

The Pages:

Page A has an imbedded IFrame which displays Page B.

Page A has a radio button which on the onClick event calls a function which

changes the source of the IFrame and sends a variable to the newly loaded
page. The Problem is the variable is passed to the page that was contained
in the IFrame before the new page is loaded (see code).

So what I intend is change page in frame, pass variable to new page....

What I get is pass variable to page, change page...

** Code snippets in programmatic order

*the source of the frame is changed *

// change source of IFrame

document.frames[CandyBoxFrameName].location.href=this.boxImage;



* then I wish to pass to the new page a variable

// pass variable to new page

document.frames[CandyBoxFrameName].candyArray=this.BoxContents;

* and finally call a function from the newly loaded content

// call function in new page

document.frames['boxIFrame'].showCandies();





Thank you
 
L

Lee

Paul said:
The problem I am having involves the sequence of events between frames in an

html page.

The Pages:

Page A has an imbedded IFrame which displays Page B.

Page A has a radio button which on the onClick event calls a function which

changes the source of the IFrame and sends a variable to the newly loaded
page. The Problem is the variable is passed to the page that was contained
in the IFrame before the new page is loaded (see code).

So what I intend is change page in frame, pass variable to new page....

There's no reliable way to know how long it will take to load the new
page, so you should either pass the variable to the frame encoded in
the search part of the URL, or have an onload event handler in the
new page look for a global value in your main page.
 
P

Paul

I don't think the problem is related to a delay in the loading of the page.
Because if I put a while statement in between the load and the following
action the while loop never exits.

In other words..

// load new content

document.frames[CandyBoxFrameName].location.href=this.boxImage;

// goof off while waiting for page to load

while(document.frames[CandyBoxFrameName].readyState !='complete')
{goof off}

// pass variable to new page
document.frames[CandyBoxFrameName].candyArray=this.BoxContents;

So I am wondering if the browser doesn't refresh content untill all the
scripts on the current page have been completed.

Paul
 
L

Lee

Paul said:
I don't think the problem is related to a delay in the loading of the page.
Because if I put a while statement in between the load and the following
action the while loop never exits.

It is the delay. The fact that nothing else can happen while you've
got the CPU locked up in a loop doesn't tell you anything about what
happens to more reasonable scripts.
 
P

Paul

You guys where correct.

The solution used for this problem was to have the onload event of the child
page pull the variable from the parent page.

Thank you for your assistance.

Paul


Paul said:
I don't think the problem is related to a delay in the loading of the page.
Because if I put a while statement in between the load and the following
action the while loop never exits.

In other words..

// load new content

document.frames[CandyBoxFrameName].location.href=this.boxImage;

// goof off while waiting for page to load

while(document.frames[CandyBoxFrameName].readyState !='complete')
{goof off}

// pass variable to new page
document.frames[CandyBoxFrameName].candyArray=this.BoxContents;

So I am wondering if the browser doesn't refresh content untill all the
scripts on the current page have been completed.

Paul


Lee said:
Paul said:
in
an

There's no reliable way to know how long it will take to load the new
page, so you should either pass the variable to the frame encoded in
the search part of the URL, or have an onload event handler in the
new page look for a global value in your main page.
 

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