GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Javascript alert box on exit?? (https://gfy.com/showthread.php?t=757395)

st0ned 08-04-2007 04:41 AM

Javascript alert box on exit??
 
I have been searching high and low but can't seem to find what I am looking for. Basically I want an alert box with ok/cancel or yes/no to popup when someone exits my website. Say I were to have the alert say "Do you want 100% FREE PORN?"'' and they click ok it takes them to porn.com, but if they click cancel it just exits. Can anyone help me on this subject?? It is irritating the shit out of me. Any help would be appreciated! :helpme

polle54 08-04-2007 05:09 AM

<body onunload="function()">

<script type="text/javascript">
function function()
{
alert("hello world");
}
</script>

I think

polle54 08-04-2007 05:11 AM

well didn't read your thread properly... you should use some dialog thing instead of alert there.

polle54 08-04-2007 05:20 AM

actually when I come to think of it... the onunload event fires after the unload so you might wanna look for another event :)

<script type="text/javascript">
function MsgOkCancel()
{
var fRet;
fRet = confirm('Are you sure?');
if (fRet==true)
{
//fire unload event here.
}
}
</script>

but just consider these bumps... can't remember which event that fires before onunload.


All times are GMT -7. The time now is 01:55 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123