admin管理员组文章数量:1420938
I have a page which dynamically loads pages into an iframe.
I found scripts on the web, which adjust the height of the iframe depending on the height of it's content.
But it does not work if the content page hast (normal)frames itself.
Now I want to check, whether the content page has frames or not, or even better access them so that I can calculate their lenght and then choose the highest length value from the subframes to be to length of my iframe.
Please help without JQuery. Just plain old Javascript. :-)
Thanks
I have a page which dynamically loads pages into an iframe.
I found scripts on the web, which adjust the height of the iframe depending on the height of it's content.
But it does not work if the content page hast (normal)frames itself.
Now I want to check, whether the content page has frames or not, or even better access them so that I can calculate their lenght and then choose the highest length value from the subframes to be to length of my iframe.
Please help without JQuery. Just plain old Javascript. :-)
Thanks
Share Improve this question asked Oct 12, 2012 at 21:16 DenderDender 1651 silver badge7 bronze badges 2- 7 @BradGilbert why must i use it? sometime is overkilling use a framework only for a function – user757095 Commented Oct 12, 2012 at 21:29
- If you say you can't use something, the reason should be in the question. Also as far as I know JQuery is "Just plain old Javascript" with a good API. – Brad Gilbert Commented Oct 12, 2012 at 21:40
1 Answer
Reset to default 3you can access the frames property of the window object. it's an array containing all the frames in the current document.
// suppose a max of 1 frame each inner frame
function getInnerFrame(win) {
win = win || window;
if (win.frames.length > 0)
return getInnerFrame(win.frames[0]);
else
return win;
}
EDIT: corrected a very stupid error
本文标签: javascriptget all frames from within Iframecheck whether iframes content has framesStack Overflow
版权声明:本文标题:javascript - get all frames from within Iframecheck whether iframes content has frames - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745324046a2653509.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论