2009-05-07 46 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