/    Sign up×
Community /Pin to ProfileBookmark

Delay on window.close()

Hi Guys,

I have a simple script for a function and then to load the funstion as follows:

<script language=”javascript” type=”text/javascript”>
<!–
function closeWindow() {
window.close(this);
}
//–>
</script>

<body onload=”closeWindow()”>

There is a reason why I need this as a funtion but wondered how I can delay the closure of the window by 3 seconds. Any ideas please?

Many thanks

Dan

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@skywalker2208Jan 19.2009 — Use the javascript setTimeout function. You put in a number of milliseconds to wait till the javascript code runs.
Copy linkTweet thisAlerts:
@DanbabeauthorJan 19.2009 — Thanks very much for your time. That worked perfectly!

Cheers again

Dan
×

Success!

Help @Danbabe 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.4,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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