zw1971
09-18-2003, 03:28 PM
I know deleteRow() can do it, but how can I delete all rows while keep the table?
thanks
thanks
|
Click to See Complete Forum and Search --> : is there a way to delete all rows in a table zw1971 09-18-2003, 03:28 PM I know deleteRow() can do it, but how can I delete all rows while keep the table? thanks Vladdy 09-18-2003, 03:53 PM If you delete all rows, why keep the table :confused: BengalTigger 06-06-2008, 01:56 PM Yes, you can delete all rows and still keep the table: for(var i=document.getElementById("tableId").rows.length;i>0;i--) { document.getElementById("tableId").deleteRow(i-1); } mrhoo 06-06-2008, 03:17 PM If you are keeping the table you may want to keep a thead or tfoot- var T= document.getElementById("tableId"); var B=T.getElementsByTagName('tbody'); var L=B.length; while(L)T.removeChild(B[--L]); BengalTigger 06-06-2008, 03:22 PM Works great... webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |