Click to See Complete Forum and Search --> : Getting columns size in javascript


mickcarlson
January 27th, 2006, 03:37 PM
Hi, is there a way to get the numbers of columns of a table? (not the width of a cell)

regards

Dr. Script
January 27th, 2006, 04:33 PM
Yes. You can get the length of the childNodes of a row. If you get a row object named r, r.childNodes.length refers to the number of columns. You can get a row using: var r = document.getElementById('tableID').rows[0];

You might be able to use r.cells.length, but I'm not sure of that support. Try it out, and get back to us on it ...