Is there something wrong with submit()
? It doesn't seem to be working for me.
<html>
<head>
<title>This is the title</title>
<script type = "text/javascript">
function onLoad() {
document.getElementById("input1").value="text1";
document.getElementById("input2").value="text2";
document.getElementById('form').submit();
}
</script>
</head>
<body onload="onLoad();">
<form method="post" name="form" id="form" action="test.txt">
<label for="input1">Input1</label> <input id="input1" name="input1" type="text"/>
<label for="input2">Input2</label> <input id="input2" name="input2" type="text"/>
<input name="submit" id="submit" value="submit" type="submit"/>
</form>
</body>
</html>