title: How to create a form dynamically using JavaScript?
body: <p>I want to create a invisible form anywhere into a HTML page dynamically using JavaScript and then submit automatically.<br>
  I want to create the form given below:</p>
  
  <pre><code>&lt;form name='myForm' method='post' action='http://www.another_page.com/index.htm'&gt;
  &lt;input type='text' name='myInput' value='Values of my input'&gt;
  &lt;input type='hidden1' value='Hidden value 1'&gt;
  &lt;input type='hidden2' value='Hidden value 2'&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I tried using the JavaScript below:</p>
  
  <pre><code>my_form=document.createElement('FORM');
  my_form.name='myForm';
  my_form.method='POST';
  my_form.action='http://www.another_page.com/index.htm';
  my_tb=document.createElement('INPUT');
  my_tb.type='TEXT';
  my_tb.name='myInput';
  my_tb.value='Values of my Input';
  my_tb.appendChild(my_form);
  document.body.add(my_form,document.body.elements[0]);
  document.my_form.submit();
  </code></pre>
  
  <p>But not working? How can I do that? Please help.</p>