簡體   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