PDA

View Full Version : POP UP Onload and Target Help Pretty Please


jonirvine
08-15-2002, 12:50 PM
Hello all,

I need a popup to 'popup' when a home page loads (I know, it's not my choice!). The window that popups up will contain an advert for the site, and when clicked I want the popup to close and the user taken to the specific page in the original browser.

I also only want this popup to appear once every session so the user doesn't get it everytime they revisit the home page.

Does anyone know where I can find a JavaScript that does this?

Thanks,

Jon

Jon Hanlon
08-15-2002, 07:44 PM
In the main page:

<body onload="nastyPopUp()">

<script language="Javascript">
function nastyPopUp() {
var beenHereBefore = getCookie("nasty") // see Below
if (beenHereBefore) return;
setCookie("nasty"); // see Below
poppy = window.open("popUp.html","")
return
}
</script>


In popUp.html:

<body onclick="seeYa()">
<script language="Javascript">
function seeYa() {
self.opener.location = "newPage.html" //redirect main page
setTimeout("self.close()",500); // close in half a sec
}
</script>


As for the cookie functions, do a web search on 'Bill Dortch'. Bill wrote some neat cookie functions a few years ago.

jonirvine
08-16-2002, 10:01 AM
Cheers for the reply. Unfortunatley however it doesn't seem to work. Sure there are no mistakes here?

Thanks,

torrent
08-16-2002, 10:13 AM
Did you read his post and do a search for the cookie functions? What's the error?

jonirvine
08-16-2002, 10:18 AM
It's OK.... sorted it now thanks Jon & torrent!

torrent
08-16-2002, 02:09 PM
well, jon H really :)