首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

iframe参数传递有关问题

2012-09-04 
iframe参数传递问题a.asp里面有个iframeiframe namechangenum width800 height30 allowtranspar

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规定的方法。

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

热点排行