Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with exit window

    Hi,

    I'm using the code below to launch exit window on my site and now it randomly opens one window. I would like to use that script below to open those exit windows using that bytime function, but I can't get it work. I'm pretty sure that the following line:

    open(popunder[Math.floor(Math.random()*(popunder.length))],'HBexit');

    should be changed and "bytime" function should be implemented in that line somehow. I just don't know how. Thank you.

    -----------------------

    <head>

    <script>
    var popunder=new Array()
    popunder[0]="http://www.google.com"
    popunder[1]="http://www.yahoo.com"
    popunder[2]="http://www.cnn.com"


    function bytime()

    {
    time = new Date()
    gmtMS = time.getTime() + (time.getTimezoneOffset() * 60000)
    gmtTime = new Date(gmtMS)
    hour = gmtTime.getHours()
    setTimeout("gmtClock()",1000)
    {
    if (hour < 5) window.open(LinkkiLista[0],'','toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1');

    else if (hour < 7) window.open(LinkkiLista[1],'','toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1');

    else if (hour < 24) window.open(LinkkiLista[2],'','toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1');
    }
    }
    var exit=true;
    function leave()
    {
    if (exit)
    open(popunder[Math.floor(Math.random()*(popunder.length))],'HBexit');
    }
    </script>

    </head>
    <BODY onunload="leave()">

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    You need to alter the function (leave):-

    function leave()
    {
    if (exit) {
    bytime();
    }
    }

    and alter:-

    open(LinkkiLista[0]

    to open(popunder[0] etc.

    I am unclear what HBexit does.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •