我想使用JavaScript從iframe獲取元素。我試過以下內容:如何從iframe獲取元素
var iframe = document.getElementById(「iframe id」);
var iframeWindow = iframe.contentWindow || iframe.contentDocument.parentWindow;
iframe.onload = function(){
alert(iframeWindow.getElementById('notice'));
};
有沒有人能幫我找到工作?
與跨域
感謝答覆
是在同一個域的irfame SRC?你發佈的內容應該有效,會發生什麼? (也應該接受一些答案!) – 2011-04-29 18:06:44
取消刪除它,我讀取的原始問題是詢問如何獲取iframe參考 – 2011-04-29 18:11:36