"closeit" + goodbye message?

liunx

Guest
Hi!<br />
<br />
How can i do so that if i`m using a javascript "closeit" and when i click the close button then it gives me a message (with my own text) before closing?<br />
<br />
Sorry if bad english ;)<!--content-->i guess you could use the onunload event handler, but IE lacks support for this when the browser is closed, it seems to work when the user navigates away from the page, but in other browsers like FF, it seems to work when the user closes the browser<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"<br />
"http://www.w3.org/TR/html4/loose.dtd"><br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<title>Untitled Document</title><br />
<script type="text/javascript"><!--<br />
function alertme(){<br />
alert('You are leaving the page')<br />
}<br />
//--><br />
</script><br />
</head><br />
<br />
<body onunload="alertme()"><br />
</body><br />
</html><!--content-->Hi there Aero,<br />
<br />
how about onbeforeunload ;)<!--content-->thank you both :) <br />
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"<br />
"http://www.w3.org/TR/html4/loose.dtd"><br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<title>Untitled Document</title><br />
<script type="text/javascript"><!--<br />
function alertme(){<br />
alert('See you again')<br />
}<br />
//--><br />
</script><br />
</head><br />
<br />
<body onbeforeunload="alertme()"><br />
</body><br />
</html> <br />
<br />
<br />
<br />
but now i`d like to mix it with this script:<br />
(it asks for name when the page is loaded)<br />
<br />
<br />
<script language="javascript"><br />
<!--<br />
var namePrompt=prompt("WRITE YOUR NAME HERE","");<br />
function dispname(namePrompt) {<br />
document.write(" "+namePrompt+",");<br />
<br />
}<br />
{dispname(namePrompt);<br />
}<br />
//--><br />
</script><br />
<br />
<br />
...so that when i hit the close button then i get this message: <br />
<br />
See you again, NAME HERE<!--content-->Hi there edgarv,<br />
<br />
try it like this...<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"<br />
"http://www.w3.org/TR/html4/loose.dtd"><br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<title>hello goodbye</title><br />
<br />
<script type="text/javascript"><br />
<!--<br />
var namePrompt=prompt("WRITE YOUR NAME HERE","");<br />
<br />
function alertme() {<br />
alert("See you again "+namePrompt);<br />
}<br />
//--><br />
</script><br />
<br />
</head><br />
<br />
<body onbeforeunload="alertme()"><br />
<br />
</body><br />
</html><!--content-->
 
Top