/    Sign up×
Community /Pin to ProfileBookmark

I have a site that is being used for humor only and I was wondering if there was a way to make a certain page load into a window that would pop up a certain # of times?

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@Beach_BumDec 21.2002 — could you be more specific.

do you want the page to keep poping up when the person closes the current page? try the onunload event (goes in the body statement).

do you want to have a new window just pop up a bunch of times while they are looking at a page? try using seTimeout to rerun the function after a second or two with a counter to stop it after a certain number of times.

or do you want something else?

we can give you more specific coding advice if you narrow down what you are after.
Copy linkTweet thisAlerts:
@gil_davisDec 21.2002 — I fail to find any humor in pop-up windows.
Copy linkTweet thisAlerts:
@Beach_BumDec 21.2002 — I fail to find any humor in pop-up windows.[/QUOTE]
i would agree with you - but the humor i find in pop-up windows is that "they" assume we see them (i use pop-up stopper).
Copy linkTweet thisAlerts:
@mackillerauthorDec 21.2002 — Ok, here are the details:

When the page loads, I want a window to pop up. I want this window to pop up x times and I would like this window to keep popping up if they leave this site.

As for the humor part, it is a site making fun of the stupidity of pop ups!
Copy linkTweet thisAlerts:
@Beach_BumDec 21.2002 — then you may want to use onload="popIt()" in your body statement. Where popIt is a javascript function that uses window.open to pop up a window. in window.open you can specify the size you want. then you could use a loop/counter in the function to execute the window.open how ever many times you want.

reread what you said - you want it to keep poping even after they leave the site. then forget the loop/counter.

in the new window you open with window.open you would need to put another onload with another window.open - that way as each window loads it loads another. until it opens a window without another window.open
Copy linkTweet thisAlerts:
@mackillerauthorDec 22.2002 — ok, thanks! I am quite new to JS, so can you show me what the code would look like?
Copy linkTweet thisAlerts:
@Beach_BumDec 22.2002 — don't have any examples as i would never use a pop-up window.

but i think the syntax is:

<script type="text/javascript">

function popIt() {

window.open("nextwindow.htm","name","width=xx,height=xx");

}

</script>

put that in the head of your html

then in the body statement:

<body onload="popIt()">
×

Success!

Help @mackiller 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...