title: How to create a bookmarklet that submits a login form
body: <p>I realize this isn't terrific from a security perspective but humor me.</p>
  
  <p>Is there a way to create a bookmarklet that submits a form, such as a login form. For example, this works, but only if there is a page loaded in the current browser window:</p>
  
  <pre><code>javascript:(function(){document.body.innerHTML += '&lt;form id=f action=https://www.mysite.com/login method=post&gt;&lt;input type=hidden name=un value=uname&gt;&lt;input type=hidden name=pw value=pword&gt;';document.getElementById("f").submit();})();
  </code></pre>
  
  <p>Is there some way to construct the form right in the JavaScript and submit that?</p>