处理两个相等的选择列表

发布于 2024-12-13 01:41:57 字数 1071 浏览 4 评论 0原文

我有两个相同的选择列表,如何访问第二个?

我已经对第一个值进行了赋值,但是当对第二个值进行赋值时,它会转到第一个值。

任何人都可以帮助我。

<div id="selectNumber">
  <select id="numbers" name="numbers" tabindex="5" onchange="changeNumbers(this);">
    <option value="" selected="selected"></option>
    <option value="all">25</option>
    <option value="123">26</option>
    <option value="124">27</option>
  </select>
<a onclick="addRemoveSelectedNumber(this);">
  <img src="../../static/images/delete.png">
</a>
</div>
<div id="selectNumber">
  <select id="numbers" name="numbers" tabindex="5" onchange="changeNumbers(this);">
     <option value="" selected="selected"></option>
     <option value="all">25</option>
     <option value="123">26</option>
     <option value="124">27</option>
  </select>
<a onclick="addRemoveSelectedNumber(this);">
  <img src="../../static/images/delete.png">
</a>

坦克

I have two select list that are equal how do i access the second one?

I have put a value on the first one but when putting a value to the second it goes to the first.

Anyone can help me.

<div id="selectNumber">
  <select id="numbers" name="numbers" tabindex="5" onchange="changeNumbers(this);">
    <option value="" selected="selected"></option>
    <option value="all">25</option>
    <option value="123">26</option>
    <option value="124">27</option>
  </select>
<a onclick="addRemoveSelectedNumber(this);">
  <img src="../../static/images/delete.png">
</a>
</div>
<div id="selectNumber">
  <select id="numbers" name="numbers" tabindex="5" onchange="changeNumbers(this);">
     <option value="" selected="selected"></option>
     <option value="all">25</option>
     <option value="123">26</option>
     <option value="124">27</option>
  </select>
<a onclick="addRemoveSelectedNumber(this);">
  <img src="../../static/images/delete.png">
</a>

Tanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半葬歌 2024-12-20 01:41:57

这将从第二个选择列表中选择25

browser.select_list(:id => "numbers", :index => 1).select "25"

更多信息:https://github.com/zeljkofilipin/watirbook/blob/master/link.md

顺便说一句,你应该报告一个有多个实例的错误页面上具有相同 id 的 HTML 元素。根据 HTML 标准,ID 值应该是唯一的

This will select 25 from the second select list:

browser.select_list(:id => "numbers", :index => 1).select "25"

More information: Multiple Attributes chapter at https://github.com/zeljkofilipin/watirbook/blob/master/link.md

By the way, you should report a bug that there are multiple instances of HTML elements with the same id on the page. Per the HTML standard, ID values should be unique

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文