JS Alert Causing Loss Of Window Focus???

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

    #1

    JS Alert Causing Loss Of Window Focus???

    Hi All,

    I've got a strange problem in IE that I wonder if anyone has seen
    before. Basically, I've got a two window scenario. The parent window
    opens the child via window.open(). The child contains a form and
    submissions are processed in the child window. When the child window
    form is submitted and the results are returned, an alert box is thrown
    up via setTimeout("ale rt(....)", 2000). For some odd reason, when
    this alert is displayed, focus is transferred back to the parent
    window with the alert box on top. When you press the OK button on the
    alert, focus is transferred back to where it should be; on the child
    window. This doesn't happen all the time. But it happens. Is there
    something I can do to solve this mystery?

    Thanks.
  • Robert

    #2
    Re: JS Alert Causing Loss Of Window Focus???

    rnurse@cudbytec h.net (Robert Nurse) wrote in message news:<a967f5b9. 0411041757.5f33 ece8@posting.go ogle.com>...[color=blue]
    > Hi All,
    >
    > I've got a strange problem in IE that I wonder if anyone has seen
    > before. Basically, I've got a two window scenario. The parent window
    > opens the child via window.open(). The child contains a form and
    > submissions are processed in the child window. When the child window
    > form is submitted and the results are returned, an alert box is thrown
    > up via setTimeout("ale rt(....)", 2000).[/color]

    I'd expect this if the alert was coming from the parent window.

    [color=blue]
    > For some odd reason, when
    > this alert is displayed, focus is transferred back to the parent
    > window with the alert box on top. When you press the OK button on the
    > alert, focus is transferred back to where it should be; on the child
    > window. This doesn't happen all the time. But it happens. Is there
    > something I can do to solve this mystery?[/color]

    Why don't you eliminate the alert and unhide some text in the window
    you want a message to appear?[color=blue]
    >
    > Thanks.[/color]

    Robert+

    Comment

    • Robert Nurse

      #3
      Re: JS Alert Causing Loss Of Window Focus???

      Hi,

      I found the problem. When you submit the form on the child, the
      parent was getting refreshed. During this refresh, JS on the parent
      was running: trying to place focus on an edit control. Therefore,
      focus got transferred to the parent window as well. I took care of
      this.



      rccharles@my-deja.com (Robert) wrote in message news:<c6bb75ff. 0411051455.d856 721@posting.goo gle.com>...[color=blue]
      > rnurse@cudbytec h.net (Robert Nurse) wrote in message news:<a967f5b9. 0411041757.5f33 ece8@posting.go ogle.com>...[color=green]
      > > Hi All,
      > >
      > > I've got a strange problem in IE that I wonder if anyone has seen
      > > before. Basically, I've got a two window scenario. The parent window
      > > opens the child via window.open(). The child contains a form and
      > > submissions are processed in the child window. When the child window
      > > form is submitted and the results are returned, an alert box is thrown
      > > up via setTimeout("ale rt(....)", 2000).[/color]
      >
      > I'd expect this if the alert was coming from the parent window.
      >
      >[color=green]
      > > For some odd reason, when
      > > this alert is displayed, focus is transferred back to the parent
      > > window with the alert box on top. When you press the OK button on the
      > > alert, focus is transferred back to where it should be; on the child
      > > window. This doesn't happen all the time. But it happens. Is there
      > > something I can do to solve this mystery?[/color]
      >
      > Why don't you eliminate the alert and unhide some text in the window
      > you want a message to appear?[color=green]
      > >
      > > Thanks.[/color]
      >
      > Robert+[/color]

      Comment

      Working...