20sec countdown

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


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