AJAX学习笔记
在用IFrame做Ajax时,需要考虑的有:
- 先定义隐藏的IFrame
1 | <iframe name="myIframe" src="blank.html" style="width:0px;height:0px" frameborder="0"> </iframe> |
通过button,Href或者form提交,动态修改IFrame的src属性或者设置Href,Form的Target属性
如何在父窗口和IFrame页面传递数据
Three ways of Moving Data From an iframe to the Parent
- The iframe page can use it’s own javascripts to transfer and place the data into the parent.
1 | <script> |
- The iframe page can pass its document object as an argument to a function in the parent, thereby allowing the parent to retrieve data from the iframe.
1 | <script> |
- Place an onload event handler in the iframe tag in the parent document (this page). This method does not work with Netscape
1 | <iframe name="repIframe3" src="blank.html" onload="getIframeDoc()"></iframe> |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 石头记!
评论