473,399 Members | 2,858 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,399 software developers and data experts.

Handling Window.close event - urgent

Hi,

My requirement is
I have an asp page in which there is a textbox. If the user clicks on close(X) button in IE without entering a value in the textbox I want a pop up to appear like "Please enter the value" and the window should not close. Kindly advoice.

I don't want the browser confirmation with Ok and cancel. B'coz if the user clicks on OK the window will close.

regards,
Sowmya
Sep 11 '06 #1
2 9322
Hi,

My requirement is
I have an asp page in which there is a textbox. If the user clicks on close(X) button in IE without entering a value in the textbox I want a pop up to appear like "Please enter the value" and the window should not close. Kindly advoice.

I don't want the browser confirmation with Ok and cancel. B'coz if the user clicks on OK the window will close.

regards,
Sowmya
Here i am giving sample code
<html>
<head>
<script type="text/javascript">
var myclose = false;
function ConfirmClose()
{
if (event.clientY < 0)
{
myclose = true;
}
}
function HandleOnClose()
{
if (myclose==true)
{
window.open('http://www.google.com');
}
}
</script>
</HEAD>
<body topmargin='0' bottommargin='0' leftmargin='20' rightmargin='20' onbeforeunload="ConfirmClose()" onunload="HandleOnClose()">
</body>
</html>
Mar 6 '07 #2
ITA
2
Does anyone know why I get the blue underling error message saying "Event 'Closing' cannot be found" when I try to handle the closing event using Net 2.0 in VB? is there an imports that I have to do??


Here i am giving sample code
<html>
<head>
<script type="text/javascript">
var myclose = false;
function ConfirmClose()
{
if (event.clientY < 0)
{
myclose = true;
}
}
function HandleOnClose()
{
if (myclose==true)
{
window.open('http://www.google.com');
}
}
</script>
</HEAD>
<body topmargin='0' bottommargin='0' leftmargin='20' rightmargin='20' onbeforeunload="ConfirmClose()" onunload="HandleOnClose()">
</body>
</html>
Jun 11 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Michael Zhang | last post by:
My project uses Python-2.3.4 + Tkinter + PIL-1.1.4 to retrieve images from server and display those images. I created a thread (also a separate toplevel window) for displaying images and another...
10
by: Tom Szabo | last post by:
Is there an event when that triggers when the window is closing.... I am talking about when the user clicks on the cross on the right top corner of the window!!!
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
0
by: Dimitrios Mpougas | last post by:
Hello, I have two asp.net pages. The first is a page (main.aspx) wich has four links on it. The href value of each link is: href="view.aspx?id=1" traget="_blank" href="view.aspx?id=2"...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
8
by: jcrouse | last post by:
I am using the following code to trap errors in a sub routine: Try Executable code Catch ex As Exception Dim strInputE As String = Application.StartupPath & "\Error.txt" Dim srE As...
2
by: Adrian Parker | last post by:
We have a date control (textbox) that opens up a popup calendar window, how, when that calendar returns with the selected value can I cause the changed event to fire on the date control ? --...
6
by: somaskarthic | last post by:
Hi This is somas here. I asked query about detecting the browser close event using javascript. I want to detect the event only when the X button in the top right corner is clicked and not else...
0
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.