我有一个 Html 表单,上面有下拉控件。我想从 VB6.0 表单中选择组合框文本,并且这个组合框文本分配给 html 下拉列表,那么我该怎么做呢?
我的 vb6.0 具有与 html 表单相同的控件。
例如我的 html 代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Application</title>
</head>
<body>
Title : <select name="ddlTitle" id="ddlTitle" style="width: 70px;">
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Baba">Baba</option>
<option value="Baby">Baby</option>
</select><br />
</body>
</html>
对于 vb6.0,我尝试使用此代码,我得到一个下拉 ID,但我想从 vb6.0 组合框中将值分配给 html 下拉框
Dim HTMLI As HTMLInputElement
For Each HTMLI In TargetIE.Document.getElementsByTagName("select")
Select Case HTMLI.id
Case "ddlTitle"
Dim i As Integer
For i = 0 To Combo1.ListCount
If Combo1.ListIndex = HTMLI.Item(i).index Then
HTMLI.Item(i).Value = Combo1.Text
Exit For
End If
Next
End Select
Next HTMLI
在使用这个 HTMLI.Value 时,它给了我一个错误 Object doesn't support this property or method。所以我需要尝试的不是价值..所以vb6.0组合值被分配给Html下拉