PDA

Click to See Complete Forum and Search --> : Java Script Or VB sCRIPT


Anna
Jan 31st, 2001, 06:02 AM
Hi All

I write In Java ScriptA page that if the User Click in mistake
On the x That close the page i want
To Ask him if he really want to close
The page .hOW cAN I DO THAT IN java script ?\
Thanks
Anna

Jan 31st, 2001, 08:46 AM
Here is one solution, but I'd guess there is better one.

<head>
function MakeSureWhatTheyWant() {
var NotToClose = window.confirm("Click OK to continue. Click Cancel to return .");
if (NotToClose) {
window.alert("Welcome Back!");
window.open('YourPageRealNameHere.html');
} else window.alert("Bye for now!");

}
</head>
<body onunload=" MakeSureWhatTheyWant()">
<!--whatever-->
</body>

Make sure you change the name of your page in this code, when window.open("'YourPageRealNameHere.html'")