现在有一个页面上面是一个iframe的报表
下面是一个iframe的图形
分别向两个iframe传值
怎么传呢?
用到什么技术?简单实用的最好~

如何向一个页面中的两个iframe传值
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
7条回答 默认 最新
- 「已注销」 2011-07-22 20:34关注
例子如下:
定义主页面:demo.html,里面两个iframe:a.html、b.html
[list]
[*]demo.html
[code="html"]
<!DOCTYPE html>
[/code]
[*]a.html
[code="html"]
<!DOCTYPE html>
<br> function callBFun() {<br> parent['frame_B'].changeHiValue(document.getElementById('user').value);<br> }</p> <pre><code> function callDirect() { parent['frame_B'].document.getElementById('hi').innerHTML = '直接操作:====>' + document.getElementById('user').value; } </script> </head> <body> <h1 style="color: red;">这是a</h1> <input type="text" id="user" size="8"><input type="button" onclick="callBFun()" value="调用b中函数"><input type="button" onclick="callDirect()" value="直接操控b中的dom"> </body> </code></pre> <p></html><br> [/code]<br> [*]b.html<br> [code="html"]<br> <!DOCTYPE html><br> <html><br> <head><br> <script type="text/javascript"><br> function changeHiValue(value) {<br> document.getElementById('hi').innerHTML = '通过调用:==>>==>>' + value;<br> }<br><body> <h1 style="color: blue;">It's the b</h1> 来自A中的值:<label id="hi" style="color: red;"></label> </body>
[/code]
[/list]本回答被题主选为最佳回答 , 对您是否有帮助呢?解决评论 打赏 举报无用 1