Try the following:
var MyIFrame = document.getElementById("myframe"); var MyIFrameDoc = (MyIFrame.contentWindow || MyIFrame.contentDocument); if (MyIFrameDoc.document) MyIFrameDoc = MyIFrameDoc.document; MyIFrameDoc.getElementById("myform").submit();
UPDATE
I cannot understand why this does not work, but here is something that does:
MyIFrameDoc.getElementById("mybutton").click();
iframe.php:
<input type="submit" name="submit" value="submit" id="mybutton" />
UPDATE 2
The reason you get the submit is not a function error submit is not a function because you called your submit button submit , so MyIFrameDoc.getElementById("myform").submit actually refers to the HTMLInputElement method, not HTMLFormElement.submit() .
All you have to do is rename the submit button, for example:
<input type="submit" name="submit2" value="submit" />
source share