473,653 Members | 3,000 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with window.close()

Hello,

i want to close a popup-window with the onBlur eventHandler.

function closeIt() {
setTimeout('win dow.close()',20 00); }

<body onBlur="closeIt ()">
html
</body>

Problem:
There is a form on my page, and when a input-field gets focus, body looses
focus and the window closes.
That's not what i want. I want to close the window, if focus goes to another
window or application, but not when someone tries to fill that form.

Any idea for me?
Thanks a lot,
Martin Nadoll
Jul 20 '05 #1
2 3314
In your closeIt() function, capture event.clientX and event.clientY, and
check if the mouse coordinates are within the window's coordinates and
then close it if appropriate.

I hope this is helpful.
--
*************** *************** ******
MUSIC24SEVEN
Pioneers of the
'Digital Entertainment Industry'
http://music24seven.com
*************** *************** ******
"Martin Nadoll" <ma****@nadoll. de> wrote in message
news:bq******** *****@news.t-online.com...
Hello,

i want to close a popup-window with the onBlur eventHandler.

function closeIt() {
setTimeout('win dow.close()',20 00); }

<body onBlur="closeIt ()">
html
</body>

Problem:
There is a form on my page, and when a input-field gets focus, body looses
focus and the window closes.
That's not what i want. I want to close the window, if focus goes to another window or application, but not when someone tries to fill that form.

Any idea for me?
Thanks a lot,
Martin Nadoll

Jul 20 '05 #2

"Martin Nadoll" <ma****@nadoll. de> wrote in message
news:bq******** *****@news.t-online.com...
Hello,

i want to close a popup-window with the onBlur eventHandler.

function closeIt() {
setTimeout('win dow.close()',20 00); }

<body onBlur="closeIt ()">
html
</body>

Problem:
There is a form on my page, and when a input-field gets focus, body looses
focus and the window closes.
That's not what i want. I want to close the window, if focus goes to another window or application, but not when someone tries to fill that form.

Any idea for me?
Thanks a lot,
Martin Nadoll


Use onFocus event in your main window.
If you opened your pop-up window with newWin = window.open(... ..) then
in the main window use
<body onFocus="newWin .close()">
Wnen pop-up looses focus the main window gets it - this is my idea how to
fix the problem.
All the best,
Gennadiy


Jul 20 '05 #3

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

Similar topics

2
2680
by: Matt | last post by:
When the user click the "Close Application" button, it will close the window. That window is not called by window.open(...) before. However, when it calls window.close(), it pops up an dialog saying "The Web page you are viewing is trying to close the window. Do you want to close this window?" It that window is called by window.open(...), and I call window.close(), this problem won't happen. Any ideas?? Thanks!! <html> <head>
4
3045
by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped up, the window does not closes until I click on the window. Below is the code. Hopefully, you can help me out.
8
2551
by: rdlebreton | last post by:
Hi, Folks! I've been trying to develop my own version of these draggable layers and I have been limiting myself to IE6...for now. I have looked at some other examples to get ideas of creating an alternative to pop-up windows in a web page. The code I have works (sort of). The problem is that I can move these layers around when I move the mouse slowly, however, if I move it fast the web browser looses track of the motion and leaves the...
4
2422
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with dimensions of linked picture after clicking on a thumbnail. I found javascript which is compatible with IE, Firefox & Opera but I can't get it to work. All I get is this http://www.justfonts.com/tini/problem.html (thumbnail dissapeared).
1
6951
by: dibyendu_k | last post by:
Hi, There is a problem i cant solve regarding Internet Explorer 5.5. It is regarding the Print Dialog Box. From a webpage if I open a popup window (window.open()) containing buttons Print and Close. The functionality is that when i press the "print" button the Print dialog box is opened (window.print();) and when I click on the close button the popup window is closed (window.close();) But the problem occurs when 1. The Print button is...
13
6256
by: ldan | last post by:
Hi everybody, I would not consider myself an expert in javascript - but so far whatever I know, helped me reaching my goals. Recently I started to experience a lot of javascript errors related to opening up a popup window in an application I wrote. The error messages are quite diverse: "Object doesn't support this property or method" or "Unspecified error." or "The callee (server ) is not available and disappeared; all connections are...
2
1176
by: PS | last post by:
I used to open a model dialog in this way: window.showModalDialog('./Lookin.aspx',"-1",'status:no;dialogWidth:750px;dia logHeight:700px;dialogHide:true;help:no;'); On page Lookin.aspx I did some actions (on server) and close dialog window. But from some time it just stop worked.. I don't have any idea why... Recently I have installed some MS patches to system (W2k Server) mayby it's problem. Does anybody meet this kind of problem?
6
1383
by: Joe | last post by:
Hi, I have a form with Submit and cancel button. When Cancel button is clicked I want to close the browser window. Here is my sample form. To make things simple I have removed the submit button. When I click on the cancel button, the window doesn’t close. Can someone tell me what mistake I am making here? Thanks for your help, Joe
37
6318
by: Jan Tovgaard | last post by:
Hey everyone:) We have a critical problem, which I can see that other people also has ran into. In Internet Explorer 7 it is no longer possible to do a window.close after opening a window, without getting a alert message that ask if u want to close the window. This did NOT happen in Internet Explorer 6, Mozilla firefox or other browsers.
0
8811
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
8704
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...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
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
5620
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
4147
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1591
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.