ITeye博客

操作iframe中的对象

lym6520 · 2009-11-12 09:47 · JS · JavaScript · Markdown

获得iframe中的document对象

var iframe= document.getElementById(iframeID); var doc = iframe.contentDocument; if (doc == undefined || doc == null) doc = iframe.contentWindow.document;
//可以通过doc操作iframe中的标签内容了

访问iframe中的JavaScript对象或方法 var obj = iframe.contentWindow; //obj.对象 //obj.方法

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。