By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

Handling Window.close event - urgent

P: 1
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
Share this Question
Share on Google+
2 Replies


P: 3
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

P: 2
ITA
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

Post your reply

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