`
njmnjx
  • 浏览: 232342 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

页面访问Iframe中的元素或是js方法

阅读更多
一、调用方法
//兼容IE和FireFox写法
window.parent.document.getElementByTagName("iframe")[下标或"名称"].contentWindow.方法名();
//不兼容FireFox写法
window.parent.frames["名称"].add();
二、调用元素处理
window.parent.document.getElementByTagName("iframe")["名称"].contentWindow.document.getElementById("Id");


这里要注意contentWindow这个属性的使用
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics