开发者

table cell content

my goal is to make a javascript that i will run using my browser (on someo开发者_如何学JAVAne 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.

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.

now how do i go from that cell i have an ID on to the content i want? (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

Will provide you with the number, in string format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜