How to trigger a form button
This example shows how to trigger a form button by java script.
<!------>
<script type="text/javascript">
function init(){
document.getElementById('button1').click();
}
onload=init;
</script>
<h1>Test form</h1>
<br/>
<form method="post" onsubmit="alert('You submitted the form!'); return false;">
<input type="hidden" name="test" value="1" />
<input type="text" name="testvalue" value="foobar" />
<input type="submit" name="button1" id="button1" value="Submit" />
</form>
Url: http://www.jonasjohn.de/snippets/html4strict/toggle-button-js.htm
Language: JavaScript | User: ShareMySnippets | Created: Oct 16, 2013