我正面临着使用此特定代码抛出错误的帧的问题:
window.parent.frames["searchoutput"].document.open("text/html");
错误:未捕获的TypeError:无法调用未定义的方法'open'
非常感谢任何帮助。
答案 0 :(得分: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;