/    Sign up×
Community /Pin to ProfileBookmark

how do I delay pop-up window?

I am using this code to launch a pop-up window when a page loads. I need to delay it by about 5 seconds.

Can anyone tell me how to do that?

<script>

function openpopup(){
var popurl=”http://www.xx.com/xxmailweb/xxSetup?oid=153&save=1&email_address=#email_address#”
winpops=window.open(popurl,””,”width=600,height=600,”)
}

openpopup()
</script>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@JPnycOct 09.2004 — Whatever the event handler is, just put setTimeout on the call.

example:

onclick="setTimeout('openpopup()', 5000)"
Copy linkTweet thisAlerts:
@JonaOct 09.2004 — <i>
</i>&lt;script type="text/javascript"&gt;&lt;!--
var timer;

function openpopup(){
var popurl="http://www.xx.com/xxmailweb/xxSetup?oid=153&amp;save=1&amp;email_address=#email_address#";
winpops=window.open(popurl,"","width=600,height=600,");
clearTimeout(timer);
}

timer = window.setTimeout("openpopup()", 5000);
//--&gt;&lt;/script&gt;


[font=trebuchet ms][i]Edit: DUNSEL beat me to it![/i] ? [/font]
Copy linkTweet thisAlerts:
@amandab_nycauthorOct 09.2004 — Thank you. What does the 5000 mean? Is that 5 seconds?
Copy linkTweet thisAlerts:
@JonaOct 09.2004 — [font=trebuchet ms]5,000 is milliseconds, which equals 5 seconds.[/font]
×

Success!

Help @amandab_nyc 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.2,
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,
)...