How to submit form when have input type="submit" inner form using javascript? : <p>How to submit form when have input type="submit" inner form using javascript ?</p>

<p>i want to submit form using javascript (have input type="submit" inner form ).</p>

<p>i tried to use this code </p>

<pre><code>&lt;form action="" method="post" name="test_fn"&gt;
    &lt;input type="text" name="input1" value="ON"&gt;            
    &lt;input type="submit" name="submit" value="ON"&gt;          
&lt;/form&gt;

&lt;script type="text/javascript"&gt;
    setTimeout(function(){test_fn.submit();}, 0);
&lt;/script&gt;
</code></pre>

<p>but not work. how can i do that ? for submit form using javascript (have input type="submit" inner form )</p>

<p>thank</p>
