[thelist] [DOM] self aware nodes?

Peter-Paul Koch gassinaumasis at hotmail.com
Wed Aug 13 16:38:40 CDT 2003



>I'm just brushing up on my client side DOM scripting, using IE6 and
>VBScript. I've set up a proof of concept that allows you to add rows to a
>table when you click a button, by cloning a prototype, non-visible TR and
>then appending it to the TBODY.
>
>However, once the row is in the table, I need to be able to provide the
>ability to move the row up and down in the list, hopefully through a
>generic subrouting that calls the swapNode method.
>
>When I click on the button associated with the row that indicates the row
>should be moved up, I need a way to figure out the ordinal of the row that
>was clicked on, so I can figure out the ordinal of the row before it, and
>swap them.
>
>I'm looking for something along the lines of a this object, I think.

Assuming the button is in a TD in the TR, in JavaScript it would be

this.parentNode.parentNode.rowIndex

See http://www.xs4all.nl/~ppk/js/index.html?w3c_html.html#tables for an 
overview of many interesting table methods and properties, including the MS 
proprietary moveRow() method, which I think is exactly what you're looking 
for.

-------------------------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.xs4all.nl/~ppk/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
New: Browser Wars II: The Saga Continues
http://evolt.org/article/rdf/25/60181/
------------------------------------------------------------------

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail



More information about the thelist mailing list