收藏 分销(赏)

iframe-在父页面调用子页面的JS方法.doc

上传人:精*** 文档编号:9757596 上传时间:2025-04-06 格式:DOC 页数:2 大小:15.50KB
下载 相关 举报
iframe-在父页面调用子页面的JS方法.doc_第1页
第1页 / 共2页
iframe-在父页面调用子页面的JS方法.doc_第2页
第2页 / 共2页
本文档共2页,全文阅读请下载到手机保存,查看更方便
资源描述
  父页面:parent.html   代码如下:   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">   <html xmlns="">   <head>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   <title>parent</title>   <script>   function parentFunction() {   alert('function in parent');   }   function callChild() {   child.window.childFunction();   /*   child 为iframe的name属性值,   不能为id,因为在FireFox下id不能获取iframe对象   */   }   </script>   </head>   <body>   <input type="button" name="call child" value="call child" onclick="callChild()"/>   <br/><br/>   <iframe name="child" src="./child.html" ></iframe>   </body>   </html>   子页面:child.html   代码如下:   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">   <html xmlns="">   <head>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   <title>child</title>   <script>   function childFunction() {   alert('function in child');   }   function callParent() {   parent.parentFunction();   }   </script>   </head>   <body>   <input type="button" name="call parent" value="call parent" onclick="callParent()"/>   </body>   </html>   更多信息请查看IT技术专栏   
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传
相似文档                                   自信AI助手自信AI助手

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服