title: Passing a javascript variable in a JSP form
body: <p>I want to pass a value calculated on the client-side, back to the server.  Here is my code:</p>
  
  <pre><code>    &lt;script&gt;
          var today = new Date();
          function startTime() {
              document.getElementById('time').innerHTML = today.getTime();
              t = setTimeout(function () {
                  startTime()
              }, 1);
          }
          startTime();
      &lt;/script&gt;
  
      &lt;form method="POST" action="../frontier/warehouseops/servlet/TimeCalculator"&gt;
          &lt;input type="hidden" name="time" value="time"/&gt;  
          &lt;input type="submit" value="Submit" name="buttonSubmit"/&gt;  
      &lt;/form&gt;
  </code></pre>
  
  <p>What I want to happen is that the value of the javascript variable "time" gets passed to the server.  But what is happening, is simply the string "time" is being passed to the server.  How do I access the value of a javascript variable and pass it back to the server in a form?</p>