一个网页中有多个输入框,但用遍历网页中标签的方法找不到input、text之类的标签,经分析网页中使用了iframe,是不是因为这个原因找不到标签呢?如果是,怎么才能找到iframe中的标签,最好能举例说明...

解决方案 »

  1.   

    那就用webbrowser打开iframe引用的页面再遍历总可以了吧?
      

  2.   

    但是在不知道iframe引用的页面地址,也不知道iframe的名字的情况下呢,能不能用循环先访问所有的框架,在框架内再找标签呢,不知道具体怎么实现
      

  3.   

    我也没做过……只知道可以这样~http://community.csdn.net/Expert/topic/3574/3574187.xml
      

  4.   

    Private Sub Form_Load()
        Dim html As New HTMLDocument
        Dim i As Integer
        ie.Navigate "d:\1.htm"
        Set html = ie.Document
        For i = 0 To html.frames.length - 1
            GetImagSrc html.frames(i).Document
        Next
    End Sub
    Private Sub GetImagSrc(doc As Object)
        Dim i As Integer
        Dim frmhtml As HTMLDocument
        Set frmhtml = doc
        Debug.Print frmhtml.location
        For i = 0 To frmhtml.images.length - 1
            Debug.Print frmhtml.images(i).src
        Next
    End Sub1.htm内容
    <IFRAME SRC="frame.htm" STYLE="z-index:1" >
    </IFRAME>
    frame.htm内容
    <img border='0' src='1.bmp'>
    <p>
    <img border ='0' src = '2.bmp'>
    '输出结果
    file:///D:/frame.htm
    file:///D:/1.bmp
    file:///D:/2.bmp
      

  5.   

    http://community.csdn.net/Expert/topic/3617/3617842.xml?temp=.1142847
      

  6.   

    这个方法好像不行..我可不可以在网页下载完之后,加入一段java代码来填写表格呢
      

  7.   

    http://www.mvps.org/emorcillo/en/code/vb6/wbframe.shtmlGetting the IWebBrowser2 interface for each HTML frameThis code enumerates the frames of a HTML page loaded in the WebBrowser control to get they IWebBrowser2 interface.
    Note: This tip is based on the Microsoft KB article 196340 and requieres the OLELIB.TLB type library.
    EnumFrames
    Sub EnumFrames(ByVal wb As WebBrowser)
    Dim pContainer As olelib.IOleContainer
    Dim pEnumerator As olelib.IEnumUnknown
    Dim pUnk As olelib.IUnknown
    Dim pBrowser As SHDocVw.IWebBrowser2   Set pContainer = wb.Object.Document
       
       ' Get an enumerator for the frames
       If pContainer.EnumObjects(OLECONTF_EMBEDDINGS, pEnumerator) = 0 Then
       
          Set pContainer = Nothing
          
          ' Enumerate and refresh all the frames
          Do While pEnumerator.Next(1, pUnk) = 0
             
             On Error Resume Next
             
             ' Clear errors
             Err.Clear
             
             ' Get the IWebBrowser2 interface
             Set pBrowser = pUnk
       
             If Err.Number = 0 Then
                Debug.Print "Frame: " & pBrowser.LocationURL
             End If
       
          Loop
          
          Set pEnumerator = Nothing
       
       End If
       
    End Sub
      

  8.   

    实现三楼的代码可能要在References定义中加入Microsoft HTML Object Library 
      

  9.   

    For Each a In WB1.Document.Frames.框架名.Document.All
            If a.tagname = "INPUT" Then
                If a.name = "name" Then
                    a.value = "csdn"
                End If
            End If
        Next
    专拿网页数据。
    共同学习!QQ:151329155
      

  10.   

    搜索tmran的帖子,我已经发了好几遍了。懒得找了,不好意思。
      

  11.   

    用两个循环
    for x = 0 to wb1.document.all.length-1
        if wb1.document.all(x).tagname="IFRAME"then
            for y=0 to wb1.document.all(x).document.all.length-1
                if wb1.document.all(x).document.all(y).tagname="INPUT" then
                    添加处理代码
                endif 
            next   
        endif
    next