Is it possible to run a function when the red x is clicked?
-
-
Hello, I am wondering if there is some functionality with the upper right exit button when it is pushed. I need to do a check to make sure that a button was pushed (save button) before they close the browser. Is this possible? Thanks! John Michael
Do this here :
function doUnload()
{
if (window.event.clientX < 0 && window.event.clientY < 0)
{
alert("Window is closing...");
}
}
...Just do your code inside the alert.
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
Do this here :
function doUnload()
{
if (window.event.clientX < 0 && window.event.clientY < 0)
{
alert("Window is closing...");
}
}
...Just do your code inside the alert.
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
This is a real stupid question, but when I open the script, is it technically javascript? So would I write and then write your code? By the way, I'm my website is in C# Thanks! You've been a big help!</x-turndown>
Yes of course... inside <script > tag :-D :-D
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.