js操作iframe父子窗体示例
2014-05-22 00:00
627 查看
父窗体获取iframe
window.iframeId
iframe获取父窗口
window.parent
parent.html
sub.html
window.iframeId
iframe获取父窗口
window.parent
parent.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript"> function btnFn(){ window.subWin.test(); } function get(name){ return document.getElementById(name); } </script> </head> <body> <input id="name" type="text" value="222"> <input type="button" id="btn" value="点击" onclick="btnFn();"><br/> <br/><br/> <iframe src="sub.html" id="subWin" name="subWin" width="100%" marginwidth="0" height="100%" marginheight="0" scrolling="Yes" frameborder="0" valign="middle" resize="no" style="display: block;border:3px solid red;"></iframe> </body> </html>
sub.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript" > function test(){ alert(window.parent.get("name").value);//结果:222 } </script> </head> <body> 我是窗体的内容 </body> </html>
相关文章推荐
- js操作iframe父子窗体示例
- js操作iframe父子窗体
- 子窗体与父窗体传值操作的js示例
- js操作模态窗口及父子窗口间相互传值示例
- 对frameset、frame、iframe的js操作示例代码
- js操作iframe兼容各种主流浏览器示例代码
- js操作模态窗口及父子窗口间相互传值示例
- js操作Iframe非当前最上层窗体
- js对iframe内外(父子)页面进行操作
- js 父子窗口的表单操作--示例代码
- js操作iframe兼容各种主流浏览器示例代码
- 利用JS对iframe父子(内外)页面进行操作的方法教程
- JS简单实现父子窗口传值功能示例【未使用iframe框架】
- js、jquery操作父子iframe
- JS 和 JQuery 对 Iframe 内外(父子)页面进行操作
- 对frameset、frame、iframe的js操作示例代码
- 子窗体与父窗体传值操作的js示例
- JS对iframe父子(内外)页面进行操作的方法 3ff0
- ie6.0, FF2.0 父子窗体 select js 操作 (转)
- js 获得设置父子窗体的值