在網頁中有時侯會用到Iframe來嵌入另一個page
例如在"A網頁"中插入一個來源為"B網頁"的iframe

如果要在B網頁中去呼叫或使用A網頁的網頁控制項時
可以試著參考使用下例的語法

window.parent.document.getElementById("btnGO").click();

parent:A網頁(B網頁的來源)
parentWindow:Retrieves a reference to the container object of the window(取得B網頁的reference)

如此一來就可以在B網頁中呼叫A網頁btnGO按鈕的click事件了。


註:原先code有誤,謝謝GDX兄的debug和協助測試,謝謝~~
arrow
arrow
    全站熱搜

    湯瑪的吳 發表在 痞客邦 留言(1) 人氣()