html dom之iframe对象

当从父页面中需要获取使用iframe嵌入的内容时,可以使用图中后面的两个属性

var sonDocument = document.getElementById('iframe_id').contentDocument;
var sonDocument = document.getElementById('iframe_id').contentWindow.document;
// 根据获取的sonDocument对象,就可以操作body等
sonDocument.body;
sonDocument.getElementById('...');

 

posted @ 2016-06-13 15:25  理舞  阅读(253)  评论(0编辑  收藏  举报