View Full Version : Count Down
crazyryan
Dec 16th 2007, 5:22 am
Hi
Basically I want to show a message saying "Your content will be shown in 5 seconds".
Whether or not there is a real live countdown, it doesn't matter, although I'd prefer it.
After 5 seconds passes I want to show a piece of text for example.
Can anyone help me?
kmap
Dec 16th 2007, 5:41 am
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
var start=new Date();
start=Date.parse(start)/1000;
var counts=10;
function Count(){
var now=new Date();
now=Date.parse(now)/1000;
var x=parseInt(counts-(now-start),10);
if(document.form1){document.form1.clock.value = x;}
if(x>0){
timerID=setTimeout("Count()", 100)
}else{
document.write("Hello");
}
}
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('Count()',100);
-->
</script>
</HEAD>
</head>
<BODY>
</center>
<FORM NAME="form1">
You are being redirected in
<INPUT TYPE="text" NAME="clock" SIZE="2" VALUE="10">
seconds.
</FORM>
</center>
</body>
</html>
crazyryan
Dec 16th 2007, 5:48 am
Hey - how does that code work?
kmap
Dec 16th 2007, 5:51 am
yes it works
Did you tried it
just create a html file and open that in internet explorer
It will give you warning allow the content
Regards
Alex
kmap
Dec 16th 2007, 5:53 am
hi
http://ukrate.com/test.html
Regards
Alex
crazyryan
Dec 16th 2007, 5:55 am
It works but when the countdown finishes it still continues loading something.. :s
kmap
Dec 16th 2007, 5:57 am
it does not load anything after countdown
crazyryan
Dec 16th 2007, 5:58 am
My page continues loading something after..
funforums
Dec 16th 2007, 6:00 am
Script is working fine, When countdown stops you will see the text " Hello " but it keeps loading.
kmap
Dec 16th 2007, 6:02 am
No it doest not ...
Try the link i gave you in firefox
Regards
Alex
funforums
Dec 16th 2007, 6:07 am
No it doest not ...
Try the link i gave you in firefox
Regards
Alex
Don't know about crazyryan, But i am using Firefox and it happens to me.
kmap
Dec 16th 2007, 6:09 am
ok this is happening in firefox try in internet explorer
Regards
Alex
pubdomainshost.com
Dec 16th 2007, 6:10 am
Or maybe if you could specify what do you wish to achieve at the end of countdown.. like redirect to a URL ? or what ... that may help .. to help you ..
Thanks
GS
crazyryan
Dec 16th 2007, 6:21 am
Basically I want to countdown to show a <div>
Although, I need it fine in all browsers.
kmap
Dec 16th 2007, 6:34 am
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
var start=new Date();
start=Date.parse(start)/1000;
var counts=10;
function Count(){
var now=new Date();
now=Date.parse(now)/1000;
var x=parseInt(counts-(now-start),10);
if(document.form1){document.form1.clock.value = x;}
if(x>0){
timerID=window.setTimeout("Count()", 100);
}else{
location.href="http://www.ukrate.com/ebooks";
}
}
window.setTimeout("Count()", 100);
</script>
</HEAD>
<BODY>
<center>
<FORM NAME="form1">
You are being redirected in
<INPUT TYPE="text" NAME="clock" SIZE="2" VALUE="10">
seconds.
</FORM>
</center>
</body>
</html>
kmap
Dec 16th 2007, 6:35 am
http://ukrate.com/test.html
It will redirect to other page
Regards
Alex
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.