Html 如何访问放置在iframe中的控件

Html 如何访问放置在iframe中的控件,html,iframe,Html,Iframe,我有一个a.aspx页面,其中有一个iframe,其源代码是“controlsPage.aspx” 现在参考一个websource控件对象,我试图找到“controlsPage.aspx”的控件,但是这些控件是不可跟踪的 <html> <body> <asp:label Text=”Source Page”/> </body> </html> 我们的守则: wbSource.Navigate("localhost

我有一个a.aspx页面,其中有一个iframe,其源代码是“controlsPage.aspx” 现在参考一个websource控件对象,我试图找到“controlsPage.aspx”的控件,但是这些控件是不可跟踪的

<html>
  <body>
        <asp:label Text=”Source Page”/>
 </body>
</html>
我们的守则:

wbSource.Navigate("localhost:12122//a.aspx")
Dim frameCollection As HtmlElementCollection = wbSource.Document.Window.Frames("ChildFrame").Document.GetElementsByTagName("Span")
<html>
  <body>
        <asp:label Text=”Source Page”/>
 </body>
</html>
这里我们得到的frameCollection计数为0

<html>
  <body>
        <asp:label Text=”Source Page”/>
 </body>
</html>
主页->a.aspx

<html>
   <body>
         <iFrame id = “ChildFrame” src = “controlsPage.aspx”>
         </iFrame>
   </body>
</html>
<html>
  <body>
        <asp:label Text=”Source Page”/>
 </body>
</html>
框架页 controlsPage.aspx

<html>
  <body>
        <asp:label Text=”Source Page”/>
 </body>
</html>

你不能那样做。IFrame运行并独立于页面。您应该在后端解析该页面。

您可能没有注意到OP使用的是服务器端语言,而不是客户端Javascript。
<html>
  <body>
        <asp:label Text=”Source Page”/>
 </body>
</html>