javascript - 使用 Prototype 读取特定的表列

标签 javascript prototypejs

我需要读取 HTML 表格第一列的所有值,而且我不想使用 DOM 方法。我想要使​​用 Prototype 或 YUI 的更简单的解决方案。

注意:该表是由外部团队提供的网格小部件生成的。这就是为什么我们无法确定使用了哪些 ID 或类名。

简而言之,我想要这样的东西:

For each row in table XXX
   value = row.column[1].value
   do something with value ...
End For

提前致谢

最佳答案

您应该能够执行类似 $$('tr td:first-child') 的操作,它应该从每个 tr 中获取第一个 td。然后您应该能够使用 .innerHTML 来获取值。

关于javascript - 使用 Prototype 读取特定的表列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/563201/

相关文章:

css - 使用 CSS3 :not selector with IE - using Prototype

javascript - JS 和 Prototype : mouseover influencing overlying element, 为什么?

javascript - 用JS改变div背景图片

javascript - 何时重写 UI/javascript 或支付商业许可费用?

google-maps - Google Maps 和 Richfaces 3.3.3 (prototype.js 1.6.0.3) 可能不兼容

javascript - 限制使用 RequireJS 范围之外定义的脚本

javascript - Prototype 的 DOM 扩展与第 3 方 JS 库发生冲突——我最好的选择是什么?

javascript - jQuery - 在 HTML PRE 中过滤 JSON 数组

javascript - 在 angularjs 页面中显示范围内的元素

javascript - 从 JS 中的不可变数组中删除元素的最干净方法是什么?