我用以下代码填写网页表格中的文本框正常,但不知如何填写网页中的复选框及选择框呢? 
我把If UCase(vdoc.All(i).tagName) = "INPUT"改成checkbox还有vTag.Type = "text"改成checkbox也不管用 Dim i As Integer
        Set vdoc = brow.Document
        For i = 0 To vdoc.All.Length - 1 '检测所有标签
            If UCase(vdoc.All(i).tagName) = "INPUT" Or UCase(vdoc.All(i).tagName) = "TEXTAREA" Then
                Set vTag = vdoc.All(i)
                    If vTag.Type = "text" Then  
                        Select Case vTag.Name
                            Case "StartPrice"
                                vTag.Value = "1500"
                            Case "BidOrBuyPrice"
                                vTag.Value = "12000"
                            Case "featuredAmount"
                                vTag.Value = "110"
                        End Select
                    End If
            End If
   next i

解决方案 »

  1.   

    方法:比如一个网页里有以下代码
    <input type="radio" value="n" checked name="notecome">普通
    <input type="radio" value="c" name="notecome">原创
    <input type="radio" value="z" name="notecome">转帖
    <input type="button" value="发送提交" name="button"webbrowser中这么写:Private Sub Command1_Click()
        WebBrowser1.Navigate "c:\ggg.html"
    End SubPrivate Sub Command2_Click()
        Dim x
        
        For Each x In WebBrowser1.Document.All("notecome")
            If x.Value = "c" Then
                x.Checked = True
            End If
        Next
    End Sub
      

  2.   

    Dim i As Integer
            Set vdoc = brow.Document
            For i = 0 To vdoc.All.Length - 1 '检测所有标签
                If UCase(vdoc.All(i).tagName) = "INPUT" Or UCase(vdoc.All(i).tagName) = "TEXTAREA" Then
                    Set vTag = vdoc.All(i)
                        If ucase(vTag.Type) = "CHECKBOX" Then  
                            vTag.Checked = True
                        End If
                End If
       next i
      

  3.   

    Dim i As Integer
            Set vdoc = brow.Document
            For i = 0 To vdoc.All.Length - 1 '检测所有标签
                If UCase(vdoc.All(i).tagName) = "INPUT" Or UCase(vdoc.All(i).tagName) = "TEXTAREA" Then
                    Set vTag = vdoc.All(i)
                        If ucase(vTag.Type) = "CHECKBOX" Then  
                            if vTag.id="CheckMe" then'vTag.name也可
                                vTag.Checked = True
                            end if
                        End If
                End If
       next i
      

  4.   

    但是这种下拉菜单如何自动选中其中某一项呢?<select size="1" name="abc">
        <option value="1">一</option>
        <option value="2">二</option>
        <option value="3">三</option>
        <option value="4">四</option>
        <option value="5">五</option>
        </select>