我有一个工具来打开此网页对话框,该对话框包含一个表,该表在执行时将填充该对象并单击按钮以关闭该对话框,但是似乎并没有从组合框中实际选择值。我已经尝试过.SelectedIndex和.innerText,但是当我按退出按钮时,仍然提示我仍然没有选择此组合框的数据。例如,组合框的值为“选择数据”,“数据1”和“数据2”,当然,在打开网页对话框后,该组合框的默认值为“选择数据”,当我运行代码时它将焦点,单击并为该组合框提供值,作为“数据1”(来自代码),然后单击按钮,它仍会提示我我仍未选择任何数据,并且组合框值将来自我选择的数据再次从“数据1”到“选择数据”。希望我能详细解释,但是如果您有任何疑问,请告诉我。我无法提供URl,因为这是我所支持公司的系统。
下面是我的执行代码和网页对话框的HTML:
Public Sub completeReserveLog()
Dim iRes_Html As HTMLDocument
AssResScr="the title page of the URL"
Set iRes_Html = HtmlDocFromHandleJex(AssResScr, "Reserves")
If iRes_Html Is Nothing Then Exit Sub
With iRes_Html
'In this scenario is kinda confusing because I'm not really sure
'if what is really the name of my combox object. So I used these two: mvASSOC1_0 and mvASSOC1_1_0
.getElementById("mvASSOC1_1_0").Focus
.getElementById("mvASSOC1_0").Value = 1
.getElementById("mvASSOC1_1_0").Value = "Data 1"
.getElementById("mvASSOC1_1_0").Click
End With
End Sub
HTML(我将确定两个对象的代码确定为真正的对象。
<TD class=mvTD><INPUT onbeforeactivate=storeCurVal() onbeforedeactivate=checkCurVal() onfocus=showMVCBO() id=mvASSOC1_1_0 class=mvFieldStyle
onkeydown=RowUpDown() style="TEXT-ALIGN: left; BACKGROUND-COLOR: white" ondrop=callBAFieldValidated() value="Data 1" eventParams=""
validationName="Risk" decimals="" groupDigits="" cboName="mvASSOC1_0" max="" min="" validationType="text" keyfield="1" mandatory="0" code="1"></TD>
</TR></TBODY></TABLE></DIV></DIV><INPUT onchange=callBA() id=dbr3eportElement
style="HEIGHT: 1px; WIDTH: 1px; POSITION: absolute; LEFT: 0px; DISPLAY: none; TOP: 0px" name=dbreportElement fieldType="text"><SPAN id=rdesignbaisdrop
style="HEIGHT: 0px; WIDTH: 0px; POSITION: absolute; LEFT: 0px; Z-INDEX: 9999; DISPLAY: none; TOP: 0px; BACKGROUND-COLOR: transparent" name="rdesignbaisdrop"
fieldType="span">
</SPAN><SELECT onchange=hideshowMVCBO() onblur=hideMVCBO() id=mvASSOC1_0 class=mvFieldStyle onkeydown=hideMVCBO() style="WIDTH: 194px;
POSITION: absolute; LEFT: 43px; DISPLAY: none; TOP: 82px; VISIBILITY: visible" mvhFlag="_1" currentDIV="mvASSOC1_1_0"><OPTION value="">---Select Data---
</OPTION><OPTION selected value=1>Data 1</OPTION><OPTION value=2>Data 2</OPTION><OPTION value=4>Data 4</OPTION><OPTION value=12>Data 12</OPTION></SELECT>
我希望这会提供所有需要的数据。