/    Sign up×
Community /Pin to ProfileBookmark

popup after 5 sec

Hi guys,

now i got this popup window script and i wish to make the window pop up after 5 seconds the visitor view my site instead of onload… what i have to do to make this work ??

my code:
window.open(‘popup.htm’,”,’menubar=no,resizable=yes,width=430,height=580′);

please advise.

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@fredmvJan 02.2004 — <script type="text/javascript">
//<![CDATA[
onload = function()
{
setTimeout
(
function()
{
window.open('popup.htm', '', 'width=430,height=580,resizable=yes');
},
5000
);
}
//]]>
</script>
Copy linkTweet thisAlerts:
@AliciaauthorJan 02.2004 — thanks for ur help..

another question is,,

5000 = 5 seconds

then how about 15 sec ??

do u guys mind to let me know how to adjust the time ??


15 sec is it = 15000 ??
Copy linkTweet thisAlerts:
@fredmvJan 02.2004 — You're welcome. Yes; it would be 15000 since the delay is represented in milliseconds.
Copy linkTweet thisAlerts:
@AliciaauthorJan 02.2004 — why it is not working.. do u guys mind to check my code for a while ,, thanks..

my code:

if (readCookie("visited")) {

// user has been here before

}

else

{

setTimeout

(

function()

{

window.open('popup.htm', '', 'width=430,height=580,resizable=yes');

},

15000

);

}
Copy linkTweet thisAlerts:
@fredmvJan 02.2004 — Works fine for me. Maybe the function that checks to see if the cookie is set is faulty?
Copy linkTweet thisAlerts:
@AliciaauthorJan 02.2004 — it is working now.. thanks
Copy linkTweet thisAlerts:
@fredmvJan 02.2004 — Maybe you were looking at the cached version of the page? Who knows. Anyway, you're welcome. ?
×

Success!

Help @Alicia 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.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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