...

View Full Version : Problem with exit window



HarriL
07-06-2003, 06:34 PM
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()">

Philip M
07-07-2003, 07:58 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum