check whether button in clicked in popup window - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Description

check whether button in clicked in popup window

Demo Code

ResultView the demo in separate window

<html>
   <head>
      <script type="text/javascript">
    function ConfirmClose()//from w w  w . j  av a  2s  . c  o  m
    {
       if ((event.clientY < 0) ||(event.altKey) ||(event.ctrlKey)||((event.clientY < 129) && (event.clientY>107)))
        {
            console.log('event.altKey When press Alt +F4');
            console.log('event.ctrlKey When press Ctrl +F4');
            console.log('event.clientY 107 or 129 is  Alt F4');
            console.log('window closing');
        }
    }

      </script> 
   </head>
   <body topmargin="0" onbeforeunload="ConfirmClose()">  
   </body>
</html>

Related Tutorials