JS Alert Causing Loss Of Window Focus???

R

Robert Nurse

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("alert(....)", 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.
 
R

Robert

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("alert(....)", 2000).

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

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?

Why don't you eliminate the alert and unhide some text in the window
you want a message to appear?

Robert+
 
R

Robert Nurse

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.
 

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

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top