this is my first time posting here, so be please be nice. If i do something incorrectly (and admin notices), please let me know of my mistake.
So, I am attempting to make nested tables that can be toggled and collapse, the problem is that the javascript code that I have does not support that, and I do not know enough javascript to fix it.
here is the code
Expand|Select|Wrap|Line Numbers
- <script language="javascript">
- function getItem(id)
- {
- var itm = false;
- if(document.getElementById)
- itm = document.getElementById(id);
- else if(document.all)
- itm = document.all[id];
- else if(document.layers)
- itm = document.layers[id];
- return itm;
- }
- function toggleItem(id)
- {
- itm = getItem(id);
- if(!itm)
- return false;
- if(itm.style.display == 'none')
- itm.style.display = '';
- else
- itm.style.display = 'none';
- return false;
- }
- </script>
Expand|Select|Wrap|Line Numbers
- <table>
- <tbody>
- <tr><td style="background-color: #CCC"><a href="#" onclick="toggleItem('myTbody')">Toggle</a></td></tr>
- </tbody>
- <tbody id="myTbody">
- <tr><td style="background-color: #CCC"><a href="#" onclick="toggleItem('myTbodyNested')">Toggle Nested</a></td></tr>
- </tbody>
- <tbody id="myTbodyNested">
- <tr><td>Test row1</td></tr>
- </tbody>
- </table>
Thanks for the help in advanced.
Ps. The purpose of this code is for my Instrumented Profiler that I am writing in C++, and I would like it to write out an html file (which im writing out the tags manually), to display all the function calls with the children function calls being the nested table (and the children of the children and so on).