473,378 Members | 1,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

problem with window.close()

Hello,

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

function closeIt() {
setTimeout('window.close()',2000); }

<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 3300
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('window.close()',2000); }

<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('window.close()',2000); }

<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
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...
4
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...
8
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...
4
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...
1
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...
13
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...
2
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...
6
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....
37
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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.