Tôi đang cố gắng truy cập nội dung iframeTài liệu và nội dungWindow trong mã sau. Nhưng cả hai đều là null.nội dung khung nội tuyếnTài liệu và nội dungWindow is null
var iframe = document.createElement('iframe');
this.get__domElement$i().appendChild(iframe);
if (iframe.contentDocument) {
iframe.contentDocument.write("Hello");
}
else if (iframe.contentWindow) {
iframe.contentWindow.document.body.innerHTML = "Hello";
}
Ai đó có thể cho tôi biết điều gì sai trong điều này? Cảm ơn
Khi tôi làm Document.Body.AppendChild (iframe), sau đó contentDocument and contentWindow không rỗng.
Ai đó có thể cho tôi biết điều gì sai khi tôi thêm iframe vào div?
Cảm ơn rất nhiều.