Connecting Tech Pros Worldwide Help | Site Map

Get the table row index from table DOM2

  #1  
Old December 5th, 2005, 09:55 AM
sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a
Hi all

I have n tr elements in my table. i want to insert some tr in b/w trs.
so i know only row id of particular row( ex: n) and i want to insert at
n+1th position. So i want to find out the row index of my n'th
element.Is there any direct way to find out the index

hope u got my question

Thanks

  #2  
Old December 5th, 2005, 11:35 AM
RobG
Guest
 
Posts: n/a

re: Get the table row index from table DOM2


sudhaoncyberworld@gmail.com wrote:[color=blue]
> Hi all
>
> I have n tr elements in my table. i want to insert some tr in b/w trs.
> so i know only row id of particular row( ex: n) and i want to insert at
> n+1th position. So i want to find out the row index of my n'th
> element.Is there any direct way to find out the index
>
> hope u got my question[/color]

Use insertRow:

<URL: http://developer.mozilla.org/en/docs...able.insertRow >



--
Rob
  #3  
Old December 5th, 2005, 02:05 PM
Martin Honnen
Guest
 
Posts: n/a

re: Get the table row index from table DOM2




sudhaoncyberworld@gmail.com wrote:

[color=blue]
> So i want to find out the row index of my n'th
> element.Is there any direct way to find out the index[/color]

A table row element object has a property named rowIndex
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-67347567>
and a property named sectionRowIndex
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-79105901>
Check the docs there, depending on how your table is structured and
where you want to insert one of those properties might give you what you
are looking for.


--

Martin Honnen
http://JavaScript.FAQTs.com/
  #4  
Old December 5th, 2005, 02:45 PM
sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a

re: Get the table row index from table DOM2


Thanx a lot

Closed Thread