Jump to content

Restart a count down


magicadmin

Recommended Posts

Hi all,I'm trying to restart the countdown when the refresh part of the script works...refresh part...

function refreshgraffiti() {	rfsh = new Date(); rfsh = "?"+rfsh.getTime()	document.images["graffitiwall"].src = "<?php echo $graffiti_image; ?>?"+rfsh	setTimeout("refreshgraffiti()", 20*1000)	display()}

Countdown part...

		<form name="countdown" action=""><input type="text" size="1" name="CountDown" title="Time Till Next Auto Wall Reload" alt="Time Till Next Auto Wall Reload" /></form> 			<script type="text/javascript"> 			 var milisec=0 			 var seconds=20 			 document.countdown.CountDown.value='0.0' 			function display(){ 			 if (milisec<=0){ 				milisec=9 				seconds-=1 			 } 			 if (seconds<=-1){ 				milisec=0 				seconds+=1 			 } 			 else 				milisec-=1 				document.countdown.CountDown.value=seconds+"."+milisec 				setTimeout("display()",100) 			} 			</script>

What am i miss here ?? a little lost with it....Thanks

Link to comment
Share on other sites

try this

<script language="javascript" type="javascript/text">var seconds=7100;function countDown() {	if(seconds<=0) {	document.location.href="xxxxxx.xxx";	}	seconds--;	window.setTimeout("countDown()",1000);	}function resetCounter() {	seconds=7100;}<script>

where 7100 equals the number of seconds you want to count downwith this in the body tag:

<body onLoad="countDown()" onchange="resetCounter()" onmousemove="resetCounter()" onclick="resetCounter()" onscroll="resetCounter()">

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...