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?
<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>
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
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
<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>