如何将iframe内容添加到主页面? [英] How to add iframe content to main page?

查看:108
本文介绍了如何将iframe内容添加到主页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我的iframe里面有一些重要的内容,但是问题是我该如何将内容添加到iframe所在的页面中。
谢谢

解决方案

您可以使用以下功能获取iframe的内容,比您可以在主页面添加内容html 。

 函数getContentFromIframe(iFrameName)
{

var myIFrame = document.getElementById iFrameName);
var content = myIFrame.contentWindow.document.body.innerHTML;

//通过内容


检查更多详情: http://www.roseindia.net/java/pass-value-example/pass-value-from-iframe-parent.shtml


Actually i have iframe which has some important content in it ,but problem is that how can i have add content to my page in which that iframe resides. Thanks

解决方案

You can get content of iframe by using following function, than you can add content in main page html.

function getContentFromIframe(iFrameName)
{

    var myIFrame = document.getElementById(iFrameName);
    var content = myIFrame.contentWindow.document.body.innerHTML;

    //Do whatever you need with the content    

}

check for more detail : http://www.roseindia.net/java/pass-value-example/pass-value-from-iframe-parent.shtml

这篇关于如何将iframe内容添加到主页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆