2016-08-13 111 views
2

如何獲取iFrame中的所有元素?我使用一些JavaScript代碼在這裏,但我不知道接下來我做什麼,以及如何獲取裏面的所有元素中的iframe:獲取iFrame中的所有元素

<iframe id="uploads" src="https://jsfiddle.net/mekwall/up4nu/"></iframe> 

var iframe = document.getElementById('uploads'); 
var innerDoc = iframe.contentDocument; 

我使用contentDocument這是隻給出<html><body></body></html>

+0

您無法使用Javascript讀取其他域的內容。 –

回答