title: How to fill in form field, and submit, using javascript?
body: <p>If I have an html document whose rough structure is</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body class="bodyclass" id="bodyid"&gt;
  &lt;div class="headerstuff"&gt;..stuff...&lt;/div&gt;
  &lt;div class = "body"&gt;
  &lt;form action="http://example.com/login" id="login_form" method="post"&gt;
  &lt;div class="form_section"&gt;You can login here&lt;/div&gt;
  &lt;div class="form_section"&gt;
  &lt;input xmlns="http://www.w3.org/1999/xhtml" class="text" id="username"
         name="session[username_or_email]" tabindex="1" type="text" value="" /&gt;
  &lt;/div&gt;
  &lt;div class="form_section"&gt;etc&lt;/div&gt;
  &lt;div xmlns="http://www.w3.org/1999/xhtml" class="buttons"&gt;
      &lt;button type="submit" class="" name="" id="go" tabindex="3"&gt;Go&lt;/button&gt;
      &lt;button type="submit" class="" name="cancel" 
              id="cancel" tabindex="4"&gt;Cancel&lt;/button&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>You can see that there is a username field and a Go button. How would I, using Javascript, fill in the username and press Go...? </p>
  
  <p>I would prefer to use plain JS, rather than a library like jQuery.</p>