/    Sign up×
Community /Pin to ProfileBookmark

Is there a delay function in javascript?

Is there any way to select when a page is to be displayed after a given time? Let’s say I have a frameset with three frames, where the left frame is supposed to be displayed first, then after 3 seconds I want the right frame to be displayed and so on. Does anyone know?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@SlankenOgenApr 20.2004 — Yes, use setTimeout('functionName()', 2000);

This will delay the function for 2 seconds.
Copy linkTweet thisAlerts:
@fredmvApr 20.2004 — There's also a [font=courier]setInterval[/font] method which does basically the same thing except it continues until you kill it with [font=courier]clearInterval[/font].
Copy linkTweet thisAlerts:
@StefanLauthorApr 20.2004 — But what function am I supposed to delay? As far as I know, loading framesets occurs automatically, or is it controlled by a javascript function?
Copy linkTweet thisAlerts:
@SlankenOgenApr 21.2004 — Like this-

function getPage(){

parent.frames[n].location.href = "newPage.html";

}

where n is the frame number.

You can also use the frame name-

parent.frames["frameName"].location.href;
×

Success!

Help @StefanL 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.16,
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,
)...