/    Sign up×
Community /Pin to ProfileBookmark

popup problem

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”;

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriMar 30.2004 — <form><input type=image src="click2.gif" onClick="javascriptopUp('popup2.html'); return false"></form>

should do the trick
Copy linkTweet thisAlerts:
@eljafigoauthorMar 30.2004 — Thanx again, funny how many things i tried to make it work only to see that it's really that simple :o

Well, i guess i won't forget that anymore ?
×

Success!

Help @eljafigo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...