title: Multiple Javascript Countdowns on the Same Page
body: <p>Hi I'm trying to add several javascript countdowns to a single html page.  I have included the .js file below.  Right now my page only displays the first countdown.</p>
  
  <pre><code>function cdtd () {
      var end = new Date("December 25, 2013 00:01:00");
      var start = new Date();
      var timeDiff = end.getTime() - start.getTime();
      if (timeDiff &lt;= 0) {
          clearTimeout (timer);
          document.write("Deal Ended");
      }
      var seconds = Math.floor(timeDiff / 1000);
      var minutes = Math.floor(seconds / 60);
      var hours = Math.floor(minutes / 60);
      var days = Math.floor(hours / 24);
      hours %= 24;
      minutes %= 60;
      seconds %=60;
  
      document.getElementById("daysBox").innerHTML = days;
      document.getElementById("hoursBox").innerHTML = hours;
      document.getElementById("minsBox").innerHTML = minutes;
      document.getElementById("secsBox").innerHTML = seconds;
  
      var timer = setTimeout('cdtd()',1000);
  
  }
  
  function countdown () {
      var end = new Date("May 31, 2013 00:01:00");
      var start = new Date();
      var timeDiff = end.getTime() - start.getTime();
      if (timeDiff &lt;= 0) {
          clearTimeout (timer);
          document.write("Deal Ended");
      }
      var seconds = Math.floor(timeDiff / 1000);
      var minutes = Math.floor(seconds / 60);
      var hours = Math.floor(minutes / 60);
      var days = Math.floor(hours / 24);
      hours %= 24;
      minutes %= 60;
      seconds %=60;
  
      document.getElementById("daysBox").innerHTML = days;
      document.getElementById("hoursBox").innerHTML = hours;
      document.getElementById("minsBox").innerHTML = minutes;
      document.getElementById("secsBox").innerHTML = seconds;
  
      var timer = setTimeout('countdown()',1000);
  
  }
  
  function cdtd3 () {
      var end = new Date("December 25, 2013 00:01:00");
      var start = new Date();
      var timeDiff = end.getTime() - start.getTime();
      if (timeDiff &lt;= 0) {
          clearTimeout (timer);
          document.write("Deal Ended");
      }
      var seconds = Math.floor(timeDiff / 1000);
      var minutes = Math.floor(seconds / 60);
      var hours = Math.floor(minutes / 60);
      var days = Math.floor(hours / 24);
      hours %= 24;
      minutes %= 60;
      seconds %=60;
  
      document.getElementById("daysBox").innerHTML = days;
      document.getElementById("hoursBox").innerHTML = hours;
      document.getElementById("minsBox").innerHTML = minutes;
      document.getElementById("secsBox").innerHTML = seconds;
  
      var timer = setTimeout('cdtd3()',1000);
  
  }
  
  function cdtd4 () {
      var end = new Date("December 25, 2013 00:01:00");
      var start = new Date();
      var timeDiff = end.getTime() - start.getTime();
      if (timeDiff &lt;= 0) {
          clearTimeout (timer);
          document.write("Deal Ended");
      }
      var seconds = Math.floor(timeDiff / 1000);
      var minutes = Math.floor(seconds / 60);
      var hours = Math.floor(minutes / 60);
      var days = Math.floor(hours / 24);
      hours %= 24;
      minutes %= 60;
      seconds %=60;
  
      document.getElementById("daysBox").innerHTML = days;
      document.getElementById("hoursBox").innerHTML = hours;
      document.getElementById("minsBox").innerHTML = minutes;
      document.getElementById("secsBox").innerHTML = seconds;
  
      var timer = setTimeout('cdtd4()',1000);
  
  }
  
  function cdtd5 () {
      var end = new Date("December 25, 2013 00:01:00");
      var start = new Date();
      var timeDiff = end.getTime() - start.getTime();
      if (timeDiff &lt;= 0) {
          clearTimeout (timer);
          document.write("Deal Ended");
      }
      var seconds = Math.floor(timeDiff / 1000);
      var minutes = Math.floor(seconds / 60);
      var hours = Math.floor(minutes / 60);
      var days = Math.floor(hours / 24);
      hours %= 24;
      minutes %= 60;
      seconds %=60;
  
      document.getElementById("daysBox").innerHTML = days;
      document.getElementById("hoursBox").innerHTML = hours;
      document.getElementById("minsBox").innerHTML = minutes;
      document.getElementById("secsBox").innerHTML = seconds;
  
      var timer = setTimeout('cdtd5()',1000);
  
  }
  
  function cdtd6 () {
      var end = new Date("December 25, 2013 00:01:00");
      var start = new Date();
      var timeDiff = end.getTime() - start.getTime();
      if (timeDiff &lt;= 0) {
          clearTimeout (timer);
          document.write("Deal Ended");
      }
      var seconds = Math.floor(timeDiff / 1000);
      var minutes = Math.floor(seconds / 60);
      var hours = Math.floor(minutes / 60);
      var days = Math.floor(hours / 24);
      hours %= 24;
      minutes %= 60;
      seconds %=60;
  
      document.getElementById("daysBox").innerHTML = days;
      document.getElementById("hoursBox").innerHTML = hours;
      document.getElementById("minsBox").innerHTML = minutes;
      document.getElementById("secsBox").innerHTML = seconds;
  
      var timer = setTimeout('cdtd6()',1000);
  
  }
  </code></pre>