2012-12-19 209 views
0

我現在面臨的問題與這個特殊的代碼框架拋出一個錯誤幀:問題與鍍鉻

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

錯誤:未捕獲的類型錯誤:無法調用方法的不確定

任何「開放」幫助是高度讚賞。

回答

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; 
+0

其實我的代碼window.parent.frames [ 「searchoutput」] document.open( 「text/html的」)。適用於Firefox和ie,但不適用於Chrome,而且您的代碼也無法正常工作。 – Abhijit

+0

嗨,大家好,請大家幫我解決這個問題,因爲它是緊急的基礎 – Abhijit

+0

你想在新窗口中顯示iframe嗎?如果是這樣,請嘗試:'window.frames [「searchoutput」]。window.open(「text/html」);' – Moseleyi