iframe 父視窗和子視窗的呼叫方法

2022-01-31 17:29:43 字數 752 閱讀 3637

父視窗呼叫子視窗

iframe_id.iframe_document_object.object_attribute = attribute_value

例子 onclick="iframe_text.myh1.innertext='';"

子視窗呼叫父視窗

parent.parent_document_object.object_attribute = attribute_value

例子 onclick="parent.myh1.innertext='';"

上面在ie下沒有問題,但在firefox下不正常。在firefox下,應該是

父視窗呼叫子視窗

window.frames["iframe_id"].document.getelementbyid("iframe_document_object"­).object_attribute = attribute_value

例子 window.frames["iframe_text"].document.getelementbyid("myh1").innerhtml= "";

子視窗呼叫父視窗

parent.document.getelementbyid("parent_document_object").object_attribute = attribute_value

例子 parent.document.getelementbyid("myh1").innerhtml =  

應用框架時自動高度適應

iframe 父視窗和子視窗的呼叫方法

父視窗呼叫子視窗 iframe id.iframe document object.object attribute attribute value 例子 onclick iframe text.myh1.innertext 子視窗呼叫父視窗 parent.parent document objec...

iframe 父視窗和子視窗的呼叫方法

父視窗呼叫子視窗 iframe id.iframe document object.object attribute attribute value 例子 onclick iframe text.myh1.innertext http www.pint.com 子視窗呼叫父視窗 parent.par...

iframe父視窗和子視窗之間的呼叫

1 父視窗獲取子視窗 js方法 document.getelementbyid if1 contentwindow.document window.frames if1 document.body jquery方法 this contents 2 父視窗獲取子視窗高度 js方法 document.g...