0

この特定のコードがエラーをスローするフレームの問題に直面しています:

window.parent.frames["searchoutput"].document.open("text/html");

エラー: Uncaught TypeError: 未定義のメソッド 'open' を呼び出せません

どんな助けでも大歓迎です。

4

1 に答える 1

0
var frame = window.parent.frames["searchoutput"];
var frameDocument = (frame.contentWindow.document || frame.contentDocument);
frameDocument.open("text/html");

またはドキュメントを取得する方法を確認するためのより包括的なバージョン:

var doc;
if (iframe.document)
    iframe.doc = iframe.document;
else if (iframe.contentDocument)
    iframe.doc = iframe.contentDocument;
else if (iframe.contentWindow)
    iframe.doc = iframe.contentWindow.document;
于 2012-12-19T08:40:24.033 に答える