2009-05-07 96 views

回答

9
document.getElementById('IframeId').contentWindow.document.getElementById('DivId'); 
+0

優秀答案+1 – 2009-05-07 18:48:20

+4

請記住,這個(或任何其他方法)不會因爲安全限制而跨域使用 – 2009-05-07 18:54:26

9

在jQuery語法中,那將是$('iframe').contents().find('div')。 (當然,請替換您需要的任何特定的ID /類/其他選擇器)。 Tracker1的答案應該適用於標準的Javascript。

+0

jQuery方法+1 – 2009-05-07 18:53:46

+0

我更喜歡自己的jQuery方法......記住,它會中斷當深入多個iFrame時(如MS的SQL Reporting服務,呃)。 – Tracker1 2010-03-08 23:40:53