title: How to pass Variable from External JavaScript to HTML Form
body: <p>I have been trying to pass a value from an external javascript file to an HTML form with no luck. The files are rather large so I am not sure I can explain it all but ill try.</p>
  
  <p>Basically a user clicks a link then a js file is initiated. Immediately after a new HTML page loads.</p>
  
  <p>I need this value passed to the HTML page in a form field.</p>
  
  <p>Javascript:</p>
  
  <pre><code>var divElement = function(){
  divCode = document.getElementById(div1).innerHTML;
  return divCode; };
  
  document.getElementById('adcode').value = divElement(); 
  </code></pre>
  
  <p>Afterwards it should be passed to this Form field</p>
  
  <p>HTML Form Field:</p>
  
  <pre><code>&lt;p&gt;Ad Code:&lt;br&gt;
  &lt;input type="text" name="adcode" id="adcode"/&gt;
  
    &lt;br&gt;
    &lt;/p&gt;
  </code></pre>
  
  <p>Thanks for any help!</p>