js simulate form submit code example
Example 1: javascript prevent form submit
<form name="foo" onsubmit="return false">
Example 2: submit form automatically javascript
<form name="myForm" id="myForm" target="_myFrame" action="test.php" method="POST">
<p>
<input name="test" value="test" />
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<script type="text/javascript">
window.onload=function(){
var auto = setTimeout(function(){ autoRefresh(); }, 100);
function submitform(){
alert('test');
document.forms["myForm"].submit();
}
function autoRefresh(){
clearTimeout(auto);
auto = setTimeout(function(){ submitform(); autoRefresh(); }, 10000);
}
}
</script>