Monday, 30 April 2012

Browser Window Close Event in javascript and asp.net

<%@ Page Language="C#"AutoEventWireup="true"CodeFile="Detail.aspx.cs"
Inherits="Detail" %>

DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"runat="server">
<title>Detail title>
<script language="JavaScript" type="text/javascript">
function bunload()
{
if(window.event.clientX < 0 || window.event.clientY < 0)
{
var Flag = document.getElementById('hndfResetFlag').value;
if(Flag == "1")
{
document.getElementById('hndfResetFlag').value = "2";
}
window.form1.submit();
}
}
script>
head>
<body onbeforeunload="bunload()">
<form id="form1" runat="server">
form>
body>
html>

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by Blogger