HTML中IFrame父視窗與子視窗相互操作

2021-08-25 17:30:13 字數 942 閱讀 2098

//&&&&&&&&&&&&&&&&&&&&公共方法開始&&&&&&&&&&&&&&&

//父物件得到子視窗的值

//objectid是視窗標識,contentid是元素id

function getvalue(objectid,contentid)

if(isie)

elseelseelseelseelseelse

alert('還沒有開啟視窗或者已關閉');

取值:

alert(window.document.getelementbyid("opendiv").innerhtml);

賦值:

win.document.getelementbyid("opendiv").innerhtml="我是從父視窗中傳過來的值";

2.子視窗操作視窗

重新整理:

window.opener.location.reload();

//下面這種方法也可以

關閉本視窗:

//關閉本視窗

function closewindow()

elseelse{

alert("火狐不能直接關閉;需要以下設定1.開firefox,在位址列輸入about:config;2.找到dom.allow_scripts_to_close_windows這項並改為true");

HTML中IFrame父視窗與子視窗相互操作

一 iframe篇 公共方法開始 父物件得到子視窗的值 objectid是視窗標識,contentid是元素id function getvalue objectid,contentid else else 父物件向子視窗賦值 objectid是視窗標識,contentid是元素id functio...

jquery父視窗與iframe中js方法互相呼叫

1,子iframe內呼叫父類函式方法 window.parent.func 2,子iframe中獲取父介面的元素 xx window.parent.document 這個xx就是父介面中要獲取的元素的id。3,jquery 呼叫子iframe頁面中js的方法 iframefunction 是子頁面的...

父視窗操控iframe

iframe id為iframecover,其中有個classname為m ebookmaker cover的div 需要獲取iframe中的乙個div物件進行操作 參考 發現 window.frames iframecover document根本獲取不到物件,正確的方法應該是 所說,使用cont...