Link to home
Start Free TrialLog in
Avatar of Mitchel-T
Mitchel-T

asked on

Disable Javascript countdown function via click...

I have a simple Javascript countdown and redirect function on a page, is there a way to disable/enable the function via a click on the web page either with a "a href" or form button without refreshing the page?

And also...can I set a TARGET on the redirect to it opens the new page in a new window?
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
var start=new Date();
	start=Date.parse(start)/1000;
	var counts=10;
	function CountDown(){
		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("CountDown()", 100)
		}else{
			location.href="xxxxxx.asp"
		}
	}
//  End -->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
-->
</script>
 
</HEAD>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of numberkruncher
numberkruncher
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mitchel-T
Mitchel-T

ASKER

Perfect...thanks!