Log in

View Full Version : Do you want to leave?



vinno
10-06-2005, 05:27 PM
Hi, On my site i would like to have a box that when someone clicks to go to a different site on my site it will say Do you want to leave my site? then in the bottom of the box there will be yes or no bottons. does anyone know the html code for this if so please tell me!?

JoeComins
10-06-2005, 06:00 PM
i think :

<BODY onbeforeunload="HandleOnClose()">

Then, add the following JavaScript code into the <HEAD> section of your ASPX page:

<script language="javascript">
<!--

function HandleOnClose() {
if (event.clientY < 0) {
event.returnValue = 'Are you sure you want to leave the page?';
}
}

//-->
</script>

Want to hide these adverts? Register an account for free!