function execution sequence problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    function execution sequence problem

    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[CandyBoxFrameNa me].location.href= this.boxImage;



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

    // pass variable to new page

    document.frames[CandyBoxFrameNa me].candyArray=thi s.BoxContents;

    * and finally call a function from the newly loaded content

    // call function in new page

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





    Thank you


  • Lee

    #2
    Re: function execution sequence problem

    Paul said:[color=blue]
    >
    >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....[/color]

    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.

    Comment

    • Paul

      #3
      Re: function execution sequence problem

      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[CandyBoxFrameNa me].location.href= this.boxImage;

      // goof off while waiting for page to load

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

      // pass variable to new page
      document.frames[CandyBoxFrameNa me].candyArray=thi s.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" <REM0VElbspamtr ap@cox.net> wrote in message
      news:bp0hdc0bkr @drn.newsguy.co m...[color=blue]
      > Paul said:[color=green]
      > >
      > >The problem I am having involves the sequence of events between frames in[/color][/color]
      an[color=blue][color=green]
      > >
      > >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[/color][/color]
      which[color=blue][color=green]
      > >
      > >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[/color][/color]
      contained[color=blue][color=green]
      > >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....[/color]
      >
      > 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.
      >[/color]


      Comment

      • Lee

        #4
        Re: function execution sequence problem

        Paul said:[color=blue]
        >
        >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.[/color]

        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.

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: function execution sequence problem

          Paul wrote:
          [color=blue]
          > while(document. frames[CandyBoxFrameNa me].readyState !='complete')
          > {goof off}[/color]

          `readyState' is an IE-proprietary property, use the standardized `onload'
          event handler instead. Otherwise you will lock up the UA and possibly the
          system when the property is undefined; it will then evaluate to

          while (true)
          {
          // goof off
          }
          [color=blue]
          > [Top post][/color]

          Please http://www.netmeister.org/news/learn2quote.html


          PointedEars

          Comment

          • Paul

            #6
            Re: function execution sequence problem

            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" <paul0xffff@hot maill.com> wrote in message
            news:GOQsb.1754 $iS6.1416@fed1r ead04...[color=blue]
            > I don't think the problem is related to a delay in the loading of the[/color]
            page.[color=blue]
            > 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[CandyBoxFrameNa me].location.href= this.boxImage;
            >
            > // goof off while waiting for page to load
            >
            > while(document. frames[CandyBoxFrameNa me].readyState !='complete')
            > {goof off}
            >
            > // pass variable to new page
            > document.frames[CandyBoxFrameNa me].candyArray=thi s.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" <REM0VElbspamtr ap@cox.net> wrote in message
            > news:bp0hdc0bkr @drn.newsguy.co m...[color=green]
            > > Paul said:[color=darkred]
            > > >
            > > >The problem I am having involves the sequence of events between frames[/color][/color][/color]
            in[color=blue]
            > an[color=green][color=darkred]
            > > >
            > > >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[/color][/color]
            > which[color=green][color=darkred]
            > > >
            > > >changes the source of the IFrame and sends a variable to the newly[/color][/color][/color]
            loaded[color=blue][color=green][color=darkred]
            > > >page. The Problem is the variable is passed to the page that was[/color][/color]
            > contained[color=green][color=darkred]
            > > >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....[/color]
            > >
            > > 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.
            > >[/color]
            >
            >[/color]


            Comment

            Working...