gpt4 book ai didi

excel - 使用Excel VBA更改网站上下拉菜单的值

转载 作者:行者123 更新时间:2023-12-02 13:51:58 24 4
gpt4 key购买 nike

我正在编写一个 Excel 宏来填写网站上的表单。我已经编写了足够轻松地填充文本框的代码,并找到了选择单选框的代码,但我在从下拉菜单中选择信息时遇到了问题。

Example 'Gender':

The combo box has three options:

Select / Male / Female

I've tried a few variations on this:

doc.getElementsByName("xs_r_gender").Item(0).Value="Male"

...but with no luck.

这是网络源代码:

<td> <select name="xs_r_gender" id="xs_r_gender">
<option value="" selected>Select</option>
<option value="male">Male</option>
<option value="female">Female</option> </select></td>

谢谢。

最佳答案

doc.getElementById("xs_r_gender").selectedindex=1
似乎可以解决问题。 (其中1代表男性)

尽管这意味着我需要进行大量查找才能确定下拉列表中项目的值。 (对于 Sex 来说很简单,只有两个选项,但我有一些组合框,最多有 50 个选项)。如果有人知道更快的解决方案,那就太好了。与此同时,我将开始整理一些 table !!!

谢谢。

关于excel - 使用Excel VBA更改网站上下拉菜单的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15003015/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com