title: Why is the output being overwritten for this javascript
body: <p>Expanded a previous question and it is working fine with the exception to the daily output. As the user enters each week/daily intake of supplement packs it should display to screen until the number of days entered is met. If a user input 2 weeks and 3 days (number of days packs were taken each week) the output should look like:</p>
  
  <pre><code>Week 1
  Number of packs taken on Day 1 = 2
  Number of packs taken on Day 2 = 1
  Number of packs taken on Day 3 = 3
  
  Week 2
  Number of packs taken on Day 1 = 1 etc....
  </code></pre>
  
  <p>My code keeps writing over Week 1. I'm sure this is something simple that I overlooked. Maybe a variable to hold each weeks input? My code thus far...thanks for the help.</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Daily Supplement Intake Log&lt;/title&gt;
  &lt;script&gt;
  function getSup() {
      var numWeeks = parseInt(document.getElementById("week").value);
      var daysPerWeek = parseInt(document.getElementById("day").value);
      var sum = 0; 
      var i = 0; 
      var total = 0; 
  
      while(i &lt; numWeeks) {
         var d = 0; 
         var grandTotal = 0; 
         var maxPacks = 0; 
      var highDay = 0; 
      while(d &lt; daysPerWeek){
          var packsTaken = prompt("Enter the number of packs taken on week " + (i + 1) + " and day "+ (d + 1), "");
          total = parseInt(packsTaken);
          document.getElementById("output2").innerHTML+="Number of packs  for day " + (d + 1) + " = " + total + "&lt;br /&gt;";
  
              if(packsTaken &gt; maxPacks){
                  maxPacks = packsTaken;
                  highDay = d;
                  }
          sum += total;
          d++;
      }
      grandTotal += sum;
      i++;
      document.getElementById("output1").innerHTML="Week " + i + "&lt;br /&gt;";
      document.getElementById("output3").innerHTML="Week " + i + " 
      subtotal is " + sum + " supplement packs." + "&lt;br&gt;" 
      + "Week " + i + " largest day is " + maxPacks + " packs, on day " + d + "&lt;br&gt;";
  }
  document.getElementById("output4").innerHTML="The total for these weeks  
  is " + grandTotal + " supplement packs." + "&lt;br&gt;";
  }
  
  &lt;/script&gt;
  &lt;body&gt;
  &lt;header&gt;&lt;h1&gt;Daily Supplement Packet Log&lt;/h1&gt;&lt;/header&gt;&lt;br&gt;
  &lt;section&gt;
  &lt;div class="align"&gt;
  &lt;label&gt;Number of weeks:&lt;/label&gt;
  &lt;input type="text" name="textbox" id="week" value=""&gt;&lt;br&gt;
  &lt;label&gt;Number of days per week:&lt;/label&gt;
  &lt;input type="text" name="textbox" id="day" value=""&gt;&lt;br&gt;&lt;/div&gt;
  &lt;div id="button"&gt;
  &lt;button type="button" id="log" onclick="getSup()"&gt;Enter number of packs  
  taken each day&lt;/button&gt;&lt;/div&gt; 
  &lt;/section&gt;
  &lt;div id="output1"&gt;&lt;/div&gt;
  &lt;div id="output2"&gt;&lt;/div&gt;
  &lt;div id="output3"&gt;&lt;/div&gt;
  &lt;div id="output4"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>