1

网页上有一个带有代码的下拉框:

<select 
name="ctl00$ctl05$ddlCurrency" 
id="ctl00_ctl05_ddlCurrency" 
class="ddlCurrency" 
style="font-size:x-small;width: 55px; background-color: #EDEEEF;">
    <option value="AUD">AUD</option>
    <option value="EUR">EUR</option>
    <option value="GBP" selected="selected">GBP</option>
    <option value="USD">USD</option>
</select>

请告诉我如何使用 vbscript 将选定的选项值“GBP”更改为 IE 窗口中下拉框的值“USD”?

谢谢,

Pers2012

4

1 回答 1

1

尝试这个:

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "http://www.example.com/"
While ie.Busy : WScript.Sleep 100 : Wend

For Each opt In ie.document.getElementById("ctl00_ctl05_ddlCurrency").Options
  If opt.Value = "USD" Then
    opt.Selected = True
  Else
    opt.Selected = False
  End If
Next
于 2013-07-29T22:50:45.240 回答