Alan,
Thanks so much for your help... really appreciate it. (parentNode..who
knew :o) )
Peter
> something like this should work
<body>
<table border=1>
<tr><td><button
onClick="DeleteRow(this)">Delete</button></td><td>Row 1</td></tr>
<tr><td><button
onClick="DeleteRow(this)">Delete</button></td><td>Row 2</td></tr>
</table>
<script>
function DeleteRow(object)
{
while (object.tagName != 'TR')
{
object = object.parentNode
}
var lRowNumber = object.rowIndex
alert(lRowNumber)
}
</script>
</body>
-----Original Message-----
From: plscribner@w... [mailto:plscribner@w...]
Sent: Tuesday, May 28, 2002 12:36 PM
To: javascript
Subject: [javascript] rowIndex in Table
Hi All,
I've beat my head against the wall for a couple of days now so it's time
to ask for help.
Background:
I have a table which I construct on the fly. Simple enough, it just lets
users record line items on an invoice and when they are through with one
line they click a button and the line gets added to a dynamic table. They
repeat until all lines have been entered - could be 1 line coule be 100.
Problem:
The table contains a delete button in case the user blew the entry. To
know which row to delete I need the rowIndex of the button they clicked.
Do you think I can find a way to get that? I've tried 100 different
syntaxes, scoured all the documentation I can find and just can't get it.
I can find everything but how to get rowIndex.
Could anyone give me a hand with this, I'm just baffled. Thanks very much
in advance for anything you can suggest.
Regards,
Peter
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to