向iframe直接写入html内容
- REFER TO
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | var content = "<html><body>" + text + "</body></html>"; var iframe = document.createElement("iframe"); document.body.appendChild(iframe); var doc = iframe.document; if(iframe.contentDocument) doc = iframe.contentDocument; // For NS6 else if(iframe.contentWindow) doc = iframe.contentWindow.document; // For IE5.5 and IE6 // Put the content in the iframe doc.open(); doc.writeln(content); doc.close(); |
-
操作 iframe document 的 DOM
1 2 3
// Load the content into a TiddlyWiki() object var storeArea = doc.getElementById("storeArea"); };