文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>兼容IE和Firefox的Javascript访问Iframe的代码

兼容IE和Firefox的Javascript访问Iframe的代码

时间:2010-09-12  来源:dbconf

1.取得iframe对象用:

 document.getElementById("iframeId")

2.取得iframe里的页面的window对象用:

 document.getElementById("iframeId").contentWindow

或是

window.frames["iframeName"]

3.取得iframe里的页面的docuemnt对象用:

 document.getElementById("iframeId").contentWindow.document

或是

window.frames["iframeName"].document

4.访问iframe里的页面中的对象用:

 document.getElementById("iframeId").contentWindow.document.getElementById("objId")

或是

window.frames["iframeName"].document.getElementById("objId")

5.访问iframe里的页面中的javascript代码用:

 document.getElementById("iframeId").contentWindow.functionName()

或是

window.frames["iframeName"].functionName()

 

总结:

访问页面里的对象通过document对象.

访问页面里的javascript通过window对象.

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载