/    Sign up×
Community /Pin to ProfileBookmark

how to put a timer on a pice of text

hello reader …
how do i put a timer on a piece of text?

for example, I want the text “[B]Loading …….[/B]” to appear on the page for only 5 seconds after the surfer first connects to my page, and after 5 seconds the text dissappears ……

any ideas on how to do that?
i think its a pretty interesting topic … but i still need an answer as i plan on using it on my website

so thanx guys

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@PalrosJul 04.2005 — simple.

you have some script that adds an absolutely positioned div. I suggest that you add some style to the div. when it finishes running, a setTimeout will count 5 seconds then hide the div with display="none".

so something like this:

[CODE]
<style type="text/css">
#load {position: absolute; left: 0; top: 0;}
</style>

<script type="text/javascript">
<!--

function hideload()
{document.getElementById("load").style.display='none';}

document.write('<div id="load">Loading</div>');
setTimeout(hideload,5000);

//-->
</script>
[/CODE]


the css here would put the loading in the top left corner.
Copy linkTweet thisAlerts:
@helsleyJul 04.2005 — Rather than a timer, it would probably be better to create the div first thing in your body and then have a body onload function that hides the div.
×

Success!

Help @Laksh 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.20,
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,
)...