简体   繁体   English

表单元格内容

[英]table cell content

my goal is to make a javascript that i will run using my browser (on someone elses site, not mine) that will take a number from thar site and wait some time depending on the number on the site before clicking a button. 我的目标是制作一个将使用我的浏览器(在其他网站而不是我的网站上)运行的javascript,该javascript将从该网站获取一个数字,并根据该网站上的数字等待一段时间,然后单击按钮。

the number is kind of hard to find: in this site there is a table in this table there is a table cell, i got the ID from the cell (for now lets call it "tCell") inside this cell there is another table this does not have an ID, in this table there is a row (once again no ID) in this row there is two cells, and the number is the only content of this cell. 这个数字很难找到:在此站点中有一个表,在此表中有一个表单元格,我从该单元格中的单元格(现在称为“ tCell”)中获取了ID,该表中还有另一个表没有ID,此表中有一行(再次没有ID),该行中有两个单元格,而数字是该单元格的唯一内容。

now how do i go from that cell i have an ID on to the content i want? 现在如何从具有ID的那个单元格转到我想要的内容? (how to find the content of a cell then go to the right row of the table among this content) (如何查找单元格的内容,然后转到该内容中表格的右行)

i guess i will have to use something like this: 我想我将不得不使用这样的东西:

var something = document.getElementById('tCell');

and then what... 然后什么...

var something = document.getElementById('tCell');
var table = something.firstChild;
var tbody = table.firstChild;
var row = tbody.firstChild;
var firstTd = row.firstChild;
var secondTd = firstTd.nextSibling;    
var textNode = secondTd.firstChild;
var textNodeValue = textNode.nodeValue;

document.getElementById('tCell').getElementsByTagName("table")[0].getElementsByTagName("tr")[0].getElementsByTagName("td")[1].innerHTML

将以字符串格式为您提供号码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM