title: I can't make my timer on javascript to redirect to another page
body: <p>I'll try to be brief.</p>
  
  <p>I know practically nothing about programming, I'm trying to learn by myself for a personal project.
  I'm trying to do something like a timer which, when it reaches 0, redirects to another page. What I managed to build so far is this:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
  &lt;body&gt;
  
  &lt;input type="text" id="txt"&gt;
  
  &lt;body onload="startCount()"&gt;
  
  &lt;script&gt;
  var c = 10; 
  var t ; 
  var timer_is_on = 0;
  
  function timedCount() {   
  document.getElementById("txt").value = c;   
  c = c - 1;   
  t = setTimeout(timedCount, 1000); 
  }
  
  function startCount() {   
  if (!timer_is_on) {
      timer_is_on = 0;
      timedCount();   
  }
  }
  
  &lt;/script&gt;
  
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>When I try it on chrome, it doesn't run or it instantly jumps to the other page.
  If you could tell me what's wrong, or how to fix it, it would be wonderful.</p>
  
  <p>Now, I just discover(?) that I lost the other part that redirects. I used this </p>
  
  <pre><code>&lt;script&gt;
  function myFunction() {
    location.replace("https://www.w3schools.com")
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I don't know if I explained this correctly, but I appreciate the help!!</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: Thanks everyone for the answers!! It's fixed now.</p>