Javascript alert box on exit??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • st0ned
    Confirmed User
    • Mar 2007
    • 8437

    #1

    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!
    Conversion Sharks - 1,000+ adult dating offers, traffic management, and consistently high payouts.
    We will guarantee and beat your current EPC to win your dating traffic!
    Skype: ConversionSharks || Email: info /@/ conversionsharks.com
  • polle54
    Confirmed User
    • Jul 2004
    • 4626

    #2
    <body onunload="function()">

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

    I think
    Last edited by polle54; 08-04-2007, 04:10 AM.
    ICQ# 143561781

    Comment

    • polle54
      Confirmed User
      • Jul 2004
      • 4626

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

      Comment

      • polle54
        Confirmed User
        • Jul 2004
        • 4626

        #4
        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.
        ICQ# 143561781

        Comment

        Working...