document.frames不兼容火狐的问题

获取页面中嵌入的iframe的对象时,使用document.frames('testFrame').document或者document.frames['testFrame']来获得id为testFrame的iframe的DOM对象时,用火狐调试的时候,提示document.frames is not a function,因此火狐是不支持document.frames,该获取iframe的dom对象的方法只适用于IE浏览器,如何在火狐浏览器下获得iframe的对象,可以使用以下方法:

document.getElementById('iframeid').contentWindow     获取的是window对象,

document.getElementById('iframeid').contentWindow.document     获取的是window对象的DOM对象。

你可能感兴趣的:(javascript,html)