phi

I'm a Game Programmer and Frontend Engineer passionate about programming education. Math / C / C++ / C# / JavaScript / HTML5 / CSS3 / Python

phiaryjust a creator

JavaScript で iframe の中身を動的に書き換える方法

4 years ago

表題の通り

var preview = document.getElementById("preview");  
var idoc = preview.contentDocument;  
var html = "<html><body>hoge</body></html>";

idoc.open();  
idoc.write(html);  
idoc.close();  

Runstant Demo