title: How to get return value of JavaScript function in a hidden field while loading a page
body: <p>I have a function in javascript.  While loading an HTML page, I would like to store the JavaScript function's value in a hidden field.</p>
  
  <p>Suppose I have:</p>
  
  <pre><code>function add()
  {
    return 10;
  }
  </code></pre>
  
  <p>Then this 10 should be stored in a text field while loading the page:</p>
  
  <pre><code>&lt;input type='hidden' name='anything'/&gt;
  </code></pre>