繁体   English   中英

使用相同的页面创建iframe,并动态创建表格

[英]Create Iframe with the same Page and dynamically created tables

我创建了这样的动态框架:

link = window.location.href;
var iframe = document.createElement('iframe');

iframe.setAttribute("src", link);
document.body.appendChild(iframe);

我的页面只是一个本地文件,那里有一个表,然后用

cloneNode(true);

并插入:

document.body.appendChild(newTable);

但是在我的iframe中,这个动态创建的表不存在。 所以我该怎么做?

UPD:这是另一个问题,该问题在chrome中有效,但在ie和firefox中,所有iframe内容都是空的,只是空白页

UPD2:

我只是将iframe吊起并按以下方式创建它:

link = window.location.href;
var iframe = document.createElement('iframe');
iframe.setAttribute("src", link);
document.body.appendChild(iframe);

在IE和FF中,它在Iframe中显示空白页。

尝试使用importNode而不是appendChild

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM