我像这样动态生成一个 iFrame
var iframe=document.createElement('iframe');
document.body.appendChild(iframe);
var iframedoc=iframe.contentDocument||iframe.contentWindow.document;
iframedoc.body.innerHTML="HI";
小提琴:http: //jsfiddle.net/Pbj7S/
它适用于 Google Chrome、Opera、Safari,但不适用于 Firefox。
知道为什么吗?