日期:2014-05-16  浏览次数:20283 次

iframe参数传递问题
a.asp里面有个iframe <iframe name="changenum" width="800" height="30" allowtransparency="1" src="b.asp" frameborder="0" scrolling="no"></iframe>

b.asp 里有个 <form id="form1" name="form1" method="post" action="">
  <input name="num" type="text" id="num" />
</form>


现在就是b里的num值,变化时,让a里面同样表单的num值跟着变化
 
如何实现,谢谢大家

------解决方案--------------------
HTML code
<input name="num" type="text" id="num"
onchange="opener.document.getElementById('num').value=this.value"; />

------解决方案--------------------
HTML code
<input name="num" type="text" id="num"
onchange="parent.document.getElementById('num').value=this.value;" />

------解决方案--------------------
这js写b.asp 里数值改变事件里面,num为a.asp 的输入框id,nums为b.asp 的输入框id
parent.document.getElementById("num").value = document.getElementById('nums').value;
------解决方案--------------------
探讨
引用:

HTML code
<input name="num" type="text" id="num"
onchange="parent.document.getElementById('num').value=this.value;" />

应该用parent。。窗口打开的才用window.opener


确实,我大脑短路了。

------解决方案--------------------
这个document.getElementById是w3c规定的方法。

所以肯定都能用。楼主看看哪写错了吧