# 20sec countdown

**URL:** <https://forum.kirupa.com/t/20sec-countdown/152230>\
**Category:** web dev\
**Created:** [June 22, 2005, 8:09am UTC](https://forum.kirupa.com/t/20sec-countdown/152230 "2005-06-22T08:09:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sWo0p](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@sWo0p](https://forum.kirupa.com/u/sWo0p)\
**Post date:** [June 22, 2005, 8:09am UTC](https://forum.kirupa.com/t/20sec-countdown/152230/1 "2005-06-22T08:09:33Z")

</div>

hi guys… say i have a little script here that counts down 1 secound at a time HIDDEN, my goal is that you see a counter couting down… how am i gonne do this with this script

```php

<script>
<!--
  var targetURL="{URL}" //points to a link in my template	
  var currentsecond=20 // secounds in timer
    function countredirect()<%
      if (currentsecond!=1)<%
    currentsecond-=1 // countdown 1 sec @ a time
 %>else<%
  window.location=targetURL
return
 %>
 setTimeout("countredirect()",1000)
 %>
 countredirect()
 //-->
 </script>

```

my best gess is to us a input with a interval… but how…
