I have a table that starts like this:
11 12 13
21 22 23
31 32 33
41 42 43
The html has no id's or spans or divs to work with and I cannot change that fact, this is purely traversing DOM stuff here.
We have an HTML page that has 12 buttons on it and each button as its own function that does something particular.
I have already figured out adding rows and columns (while dynamically updating the reference text in each cell appropriately), stylizing the rows, summing the rows and then columns, etc.
Now what I am stuck on is making the raw data (i.e. the text nodes) in each cell disappear with 1 function. (Problem is that there is a secondary function that will make it reappear so it makes it a little bit more difficult). I cannot use innerHTML - have to use DOM only. I also have to be sure the table does not collapse or disappear - only the values in each cell.
Any suggestions?
Sorry, forgot to add what I have done so far, well at least the step that I am on right now:Problem is, I get rawData[j].firstChild.style is undefined.
Expand|Select|Wrap|Line Numbers
- var tbl = document.getElementById("users_table");
- var tblRows = tbl.getElementsByTagName("tr");
- var rawData = tbl.getElementsByTagName("td");
- //tblRows.item(0).style.height = ("23px");
- for(j = 0; j < rawData.length; j++) {
- //rawData[j].style.display = "none";
- rawData[j].firstChild.style.display = "none";
- }
- // alert ("Raw data has been hidden")
- } // end hideRawData