【问题标题】:Get WebBrowser Control to Check Radio Option获取 WebBrowser 控件以检查单选选项
【发布时间】:2022-07-19 19:27:28
【问题描述】:

我希望我的 vb6 程序检查单选选项并通过 PHP 页面提交。我有以下代码:

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
   If WebBrowser1.LocationURL = \"http://xx.xxxxxxxxxx.com/vb6.php\" Then
      WebBrowser1.Document.frmC.cid.Value = \"52821558\"
      WebBrowser1.Document.frmC.instrument.Value = \"CL\"
      \'WebBrowser1.Document.frmC.ctype
      WebBrowser1.Document.frmC.Submit.Click
   End If
End Sub

上面代码中的\"ctype\" 代表单选选项的名称,下面是它的 HTML 代码

<INPUT TYPE=\"Radio\" Name=\"ctype\" value=\"Buy\"><span style=\"font-size: 14px\">Buy</span>
<INPUT TYPE=\"Radio\" Name=\"ctype\" value=\"Sell\"><span style=\"font-size: 14px\">Sell</span>

    标签: vb6


    【解决方案1】:

    使用SetAttribute

    Dim radio As Object
    Set radio = WebBrowser1.Document.frmC.ctype.Item(0)
    radio.SetAttribute "checked", "checked"
    

    第一个收音机使用.Item(0),第二个收音机使用.Item(1)

    【讨论】:

      猜你喜欢
      • 2014-01-03
      • 2011-01-22
      • 1970-01-01
      • 2011-04-14
      • 1970-01-01
      • 2012-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多