473,796 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Jul 23 '05 #1
2 2304
rn****@cudbytec h.net (Robert Nurse) wrote in message news:<a9******* *************** ****@posting.go ogle.com>...
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).
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?
Thanks.


Robert+
Jul 23 '05 #2
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.

rc*******@my-deja.com (Robert) wrote in message news:<c6******* *************** ***@posting.goo gle.com>...
rn****@cudbytec h.net (Robert Nurse) wrote in message news:<a9******* *************** ****@posting.go ogle.com>...
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).


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?

Thanks.


Robert+

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4993
by: Justin Koivisto | last post by:
Is there a way to create an alert-like message box that uses a custom image? Basically, I want to replace the default ! image with something else. -- Justin Koivisto - spam@koivi.com PHP POSTERS: Please use comp.lang.php for PHP related questions, alt.php* groups are not recommended.
1
1715
by: Ian Shere | last post by:
I'm pretty green when it comes to web design and worse regarding JS - I'm a true cut n paste hacker and good at that!! LOL Two questions. I have a bunch of FAQ's as text questions that I want to do either one of the following with when a visitor clicks the question - 1) Open a pop-up window of X x Y size, centred with no controls, or 2) Have an alert box do the same. I know the syntax for the pop-up window but not how to tie it to a...
1
16606
by: Barry Svee | last post by:
I'm struggling with the JavaScript blur event. I have an activex control that I need to interact with when a window loses focus, namely to instruct it to give up control of a barcode scanner so that the application being brought foreward can take control. It has been my observation that when I set the window.onblur function, the window will gain focus and then immediately lose focus (blur) to the first field, button, or whatever that is...
1
1708
by: Tavish Muldoon | last post by:
Hello, I have same Javascript that performs a little quiz after choose selections from radio buttons. It displays the number of answer that one got right. But it puts them in an alert box - I want it to be in a new window. The alert box works fine and show the correct data. The button:
1
2152
by: Colin Graham | last post by:
Hi there, i want to create a piece of javascript that checks to see if a popup window is open when the user clicks on the main form. If the popup is open it will set focus back to the popup and display an alert message. im not sure of the event to use on the main form to call the function or how to write the function. any help greatly appreciated as im a bit pushed for time on this one.
11
4591
by: Alistair Saldanha | last post by:
I'm looking for the event that is fired by Internet Explorer to an "alert": <SCRIPT> Alert("You already have a session open") </SCRIPT> The event would be webBrowser.Document.???? Much appreciate any help you can give me. Thanks,
1
1574
by: Alex Calder | last post by:
How's that for a subject line? :) OK, here's the deal. I have a web page that features a Flash movie about halfway down the page, and inside that Flash movie is content that typically exceeds the height of the movie, and accordingly, scrolls via use of a scroll bar. I've been testing out this page on friends, and the common complaint
4
1597
by: Michael | last post by:
can anyone explain why I get an endless loop of alerts (alert - hit enter - alert - hit enter etc) from the following script/page? It works ok in IE, and works ok in FF if I use the mouse to click the "ok", but not if I use the enter key.... <html> <head> <title>Test</title> <script type="text/javascript">
24
8231
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and seems to have a (tiny) amount overhead since window itself points to the global object, hence, a circular reference. (From everything I am reading, window is just a REFERENCE back to the global object, as opposed to a separate object.)
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.