Forum Moderators: open
<html>
<head>
<!--
Code By "CodeFreak" Cloud - codefreak.proboards19.com - 2003
You may leave this part of code intact to show your gratitude or remove it
-->
<script language=javascript>
function confirmit()
{
var closeit= confirm("Do you really want to close this page?");
if (closeit == true)
{window.close();}
else
{window.open("test01.html");}
}
</script>
</head>
<body onunload="confirmit();">
Body content goes here.
</body>
</html>
note: test01.html is the code page name, you can change it to whatever your page name is.
Hmm is this code fulfill your needs?
<script language=javascript>
function confirmit()
{
var closeit= confirm("Do you really want to close this page?");
if (closeit == true)
{}
else
{window.open("test01.html");}
}
</script>
I remove the window.close() function because there are the times the user will change the url but not intend to close the browser.
<html>
<head>
<!--
Code By "CodeFreak" Cloud - codefreak.proboards19.com - 2003
You may leave this part of code intact to show your gratitude or remove it
-->
<script language=javascript>
function confirmit()
{
event.returnValue = "You can add some comment Here";
}
</script>
</head>
<body onbeforeunload="confirmit();">
hahhahahhahaa
</body>
</html>
This code will work perfectly as you wish.
how ever the "Are You sure you want to navigate away from bla bla" cannot be removed or altered..
Instead of onunload, I use onbeforeunload, so the page will not be close down :)
EDIT: OMG, there is an edit button! sorry about that.. 2 above post can be delete.