I’ve put 2 popups on my index page and my problem is the following: one popup is supposed to open when the user closes the window and the other if the user clicks on a link that is on the page. Well, the scripts seem to work, however when you click on the link for the popup to show, the other popup that is supposed to open when the window is closed (onunload) shows also.
I guess when you click on a popup to open the current page is refreshed and it seems to have the same effect as exiting the window causing the other popup to show too.
Now, my question is: does anyone of you know how to prevent this from happening? THX!
I’ll put some lines of the code below so you have an idea of the situation:
In the HEAD tags:
<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=250,height=189’);”);
}
// End –>
</script>
Somewhere on the page POPUP (onclick):
<form><input type=image src=”click2.gif” onClick=”javascript:popUp(‘popup2.html’)”></form>
Somewhere on the page POPUP (onunload):
<body OnUnLoad=”checkCount()” bgcolor=”#FFFFFF”>
<script LANGUAGE=”JavaScript”>
var expDays = 1; // number of days the cookie should last
var page = “popup.html”;
var windowprops = “width=250,height=200,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no”;