473,396 Members | 1,797 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,396 software developers and data experts.

How to detect the X button in IE8

Dear Sir,
I am trying to catch the close button event(X) at internet explorer 8.
i trying with follwoing code.but in that case i can detect tab button while it's close(X) is clicked.

Expand|Select|Wrap|Line Numbers
  1. function closeIt(){
  2.  
  3. if( !event) { event = window.event ; } 
  4.  
  5.  if (event.clientY < 0)
  6.              {
  7.                   //event.returnValue = 'Are you sure you want to Quit?'
  8.          }
  9.    }
  10.  
  11. <body   onBeforeUnload="closeIt()">
  12. </body>
  13.  
Regards,
Faruk Chowdhury.
Aug 3 '10 #1
3 2899
gits
5,390 Expert Mod 4TB
if its just for an alert then you might try:
Expand|Select|Wrap|Line Numbers
  1. window.onbeforeunload = function() {
  2.     alert('foo')
  3. }
Aug 4 '10 #2
this doesn't work consistently in IE and Mozilla
Aug 26 '10 #3
Thanks a lot....
it works fine with IE ...
Sep 14 '10 #4

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

Similar topics

5
by: Ralph Freshour | last post by:
I'm trying to use an image as a submit button - I'm reading Sams Teach Yourself HTML and the chapter on this doesn't show me the details on how this is done - I mean I can't seem to see it or grasp...
1
by: John Michael | last post by:
Is it possible to detect when someone has pushed their Esc button on a form. When a form is open and someone is adding a record, if they push the esc button, the whole form gets reset to an empty...
0
by: hy | last post by:
Hi all, I got the question about the radio button. How do i detect previous checked radio button after i checked other's radio button. While the new radio button checked, it need to prompt out a...
8
by: thomasamillergoogle | last post by:
I am trying to detect what asp.net button was clicked duing the page_load event. I have two asp.net buttons on my page. What is the easiest way to detect this?
5
by: BenCoo | last post by:
Hello everyone, I've a form with a groupbox witch contain 4 buttons. I searching for a solutions to detect when I click on one of the buttons returning a reference to the button thas has been...
2
by: Eli | last post by:
HI! I made some quiz using one HTML form (few question with few radio-button each like potential answers) that have one Submit button. I would like to simulate click on this button (e.g. named...
3
by: umdsasha | last post by:
So, basically, I need to detect whether an alert window was thrown. I can't find where it's thrown from but I need to disable a button only if there were no alert windows thrown. Any ideas? ...
2
by: John | last post by:
Hi, I would like to create an eventhandles that handles several different buttons. How can I detect which button was clicked on ? I know it something with the sender ... something like
1
by: john ciriello | last post by:
Hi, is there an easy way to detect when the mouse pointer enters a disabled button? For example I have a button I can see but it is greyed out. When the mouse moves over it I would like to be able...
8
by: MAX2006 | last post by:
Hi, I am doing some client side javascipt work. I have a handler for window.onUnload event and within the code; I need to know the name of the asp.net button caused the postback. How can I do...
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...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.