I have a weird question. I want to create script in javascript (or PHP if I have to, I’m just more comfortable in javascript) that reads through a table until it finds specific text (know how to do that) and then returns the text three cells to the right.
To be specific, I want a script that finds a row for a specific printer on this site and returns the printer’s status. I know how to select unique text, but not so much about nonunique text.
If I understood your question correctly, this is how you could do it using jQuery:
Clarifying: the filter function will select only the column whose text equals your search text, and each call to next will return the column’s next sibling – another
td. Three calls later, you have the column you want, so you can get its text.Update: you might also be interested in this question, if the site you’re querying is not in the same domain as your script. If it is, you can simply load its contents to a div before querying it:
If it’s not, then you’ll have to load that html data somehow, and according to an anwser to that question, your best route is really to do it in PHP (or at least use it to echo the other site’s contents to your own).