p.html代码
<form action="http://www.baidu.com" method="post" name="Form0">
<input type="button" id="but2" value="button" /><br />
<iframe src="b.html"></iframe>
</form>b.html代码
<script>
function setB(){
parent.document.getElementById("but2").onclick = new Function("Form0.submit();")
}
</script>
<body onload="setB()">
<form action="http://g.cn" method="post" name="Form0">
</form>
</body>情况:p.html中的iframe装载后改变了but2按钮的onclick事件
问题:点击but2时为什么是b.html提交了,而不是p.html提交呢?这样的机制是什么?怎么解决呢?请知道的朋友赐教赐教,谢谢!!!!
<form action="http://www.baidu.com" method="post" name="Form0">
<input type="button" id="but2" value="button" /><br />
<iframe src="b.html"></iframe>
</form>b.html代码
<script>
function setB(){
parent.document.getElementById("but2").onclick = new Function("Form0.submit();")
}
</script>
<body onload="setB()">
<form action="http://g.cn" method="post" name="Form0">
</form>
</body>情况:p.html中的iframe装载后改变了but2按钮的onclick事件
问题:点击but2时为什么是b.html提交了,而不是p.html提交呢?这样的机制是什么?怎么解决呢?请知道的朋友赐教赐教,谢谢!!!!
parent.document.getElementById("but2").onclick = new Function("parent.document.Form0.submit()");
parent.document.getElementById("but2").onclick = new Function("parent.document.forms[0] .submit();")