Chris Cooper Chris Cooper - 16 days ago 7
HTML Question

return index of element in form

This is probably easy but I can't manage to get the index of a table in the form as you can see in

this picture.

I have selected the table I want the index from the following way :

IEDoc.querySelectorAll("td[width='100'][class='ListMainCent'][rowSpan='1'][colSpan='1']")(2).ParentNode.ParentNode.ParentNode.ParentNode.ParentNode.ParentNode.ParentNode


So as you can see, I selected it from one of its items.

So my question is, how can i gain the index position of this table in the form ?

Answer
  1. Use your selector to add a name or id to the table.
  2. Iterate the top level tables in the form until the table with name/id is found.

    You now have your index.

    Be sure to check the overhead of such a process.

Comments