Click to See Complete Forum and Search --> : JavaScript Pop Up


Reb80
01-04-2004, 03:23 PM
I've been working on creating a pop up for a candy fundraising website, and have come across one JavaScript code question that's been really bugging me.

The code is as follows (in the <head>):
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=300,left = 690,top = 190');");
}
// End -->
</script>

Is there any code that I'm missing that would tell the pop-up to load only the first time a user opens the site? Every time the main frame is opened, the pop-up (of course) pops up. However, it's distracting to have it open every single time a user refreshes, etc. How would I go about having this pop-up only open once for a user?

Thank you for any help you can give me! It's much appreciated.

ray326
01-04-2004, 04:40 PM
The only way I know of doing that is to set and test for a cookie with an appropriate (for your application) expiration date.

Reb80
01-06-2004, 10:10 AM
Wow, I would have no idea how to even think about doing that. lol

I was hoping there would be some kinda of value I could change in the code to open the pop up once... but the more I think about it the more I realize it's going to be very complicated, and I'm not very experienced in JavaScript coding.

Thank you for your reply, though! :)