简体   繁体   中英

Create Iframe with the same Page and dynamically created tables

I've created I frame dynamically just like this:

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

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

My page is just a local file.I have a table there.And I am copying that table with

cloneNode(true);

and inserting it with:

document.body.appendChild(newTable);

But in my Iframe this dynamycally created table doesn't exists. So what should I do?

UPD: and another problem this works in chrome but in ie and firefox all Iframe Content is empty just empty page

UPD2:

I just uppend Iframe and create it like this:

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

In Ie and FF it shows empty page in Iframe.

尝试使用importNode而不是appendChild

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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