有一个服务器端的表单页test.html,内容是:
<form action="http://127.0.0.1" method="post" id="go">
<input type="text" value="test" >
<input type="submit" value="提交" />
</form>
然后现在还有一个本地页面go.html,go.html用iframe加载了test.html,现在需要的是,打开go.html则自动提交test.html的表单,用js如何实现呢?我在go.html中写的代码是:
<html>
<iframe src="test.html" width="500" height="500">
</iframe>
<script language="javascript">
function submitForm()
{
var form=document.getElementsById("go").contentWindow.document;
form.submit();
}
</script>
</html>
但是这个代码根本提交不了,无法实现,求高手帮写一个正确的代码,万分感谢
有这么难吗?
有这么 容易我还用得着问????