出于某种原因,我无法填充下拉框(html),这是我的代码的一部分:
ie.document.forms("ctl00_m_g_da21fae8_4ec1_4753_b9e0_4941851f566b_FormControl0").Item("V1_I1_S1_I1_D8").Value = "Seller"
ie.document.forms("ctl00_m_g_da21fae8_4ec1_4753_b9e0_4941851f566b_FormControl0").Item("V1_I1_S1_I1_D8").FireEvent ("onChange")
这是来自网页的这个下拉列表的html代码的一部分:
SELECT tabIndex=0 title=""
class="ab_HZ54NFZpWLWUsncZ_0 ad_HZ54NFZpWLWUsncZ_0 he_HZ54NFZpWLWUsncZ_0 g5_HZ54NFZpWLWUsncZ_0"
id=ctl00_m_g_da21fae8_4ec1_4753_b9e0_4941851f566b_FormControl0_V1_I1_S1_I1_D8
aria-invalid=false style="DIRECTION: ltr"
onfocus="return (DropDownList.OnFocus(this, event));"
onblur="return (DropDownList.OnBlur(this, event));"
onchange="return (DropDownList.OnChange(this, event));"
OriginalId="V1_I1_S1_I1_D8" FormId="ctl00_m_g_da21fae8_4ec1_4753_b9e0_4941851f566b_FormControl0"
ViewDataNode="16" direction="ltr" wrapped="true" ScriptClass="DropDownList">
<OPTION value=""></OPTION>
<OPTION value=CSR>CSR</OPTION>
<OPTION value=Distributor>Distributor</OPTION>
<OPTION value="Lab Tech" selected>Lab Tech</OPTION>
<OPTION value=Manager>Manager</OPTION>
<OPTION value=Seller>Seller</OPTION>
<OPTION value=TS&D>TS&D</OPTION>
<OPTION value=Others>Others</OPTION>
</SELECT>`
我错过了什么?
答案 0 :(得分:1)
尝试ie.document.getElementById("ctl00_m_g_da21fae8_4ec1_4753_b9e0_4941851f566b_FormControl0_V1_I1_S1_I1_D8").selectedIndex = 5