Apr 11, 2006 #1 aigarzzz Programmer Joined Apr 5, 2006 Messages 16 Location LV i have a table: <table> <tr id="a1"><td></td></tr> <tr id="b1"><td></td></tr> <tr id="a2"><td></td></tr> <tr id="b2"><td></td></tr> </table> how can i delete a1 abd b1 rows by it's id?
i have a table: <table> <tr id="a1"><td></td></tr> <tr id="b1"><td></td></tr> <tr id="a2"><td></td></tr> <tr id="b2"><td></td></tr> </table> how can i delete a1 abd b1 rows by it's id?
Apr 11, 2006 #2 BillyRayPreachersSon Programmer Joined Dec 8, 2003 Messages 17,047 Location GB This will work for any element: Code: function deleteObjById(objId) { var theObj = document.getElementById(objId); if (theObj) theObj.parentNode.removeChild(theObj); } Hope this helps, Dan [tt]Dan's Page [blue]@[/blue] Code Couch http://www.codecouch.com/dan/[/tt] Upvote 0 Downvote
This will work for any element: Code: function deleteObjById(objId) { var theObj = document.getElementById(objId); if (theObj) theObj.parentNode.removeChild(theObj); } Hope this helps, Dan [tt]Dan's Page [blue]@[/blue] Code Couch http://www.codecouch.com/dan/[/tt]
Apr 12, 2006 #3 BillyRayPreachersSon Programmer Joined Dec 8, 2003 Messages 17,047 Location GB aigarzzz, Did that work for you? Dan [tt]Dan's Page [blue]@[/blue] Code Couch http://www.codecouch.com/dan/[/tt] Upvote 0 Downvote
aigarzzz, Did that work for you? Dan [tt]Dan's Page [blue]@[/blue] Code Couch http://www.codecouch.com/dan/[/tt]
Apr 12, 2006 Thread starter #4 aigarzzz Programmer Joined Apr 5, 2006 Messages 16 Location LV yes, that works!! Thank You Upvote 0 Downvote