| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Someone asked me to code them a table where they could hide and show rows. I tested both in IE6 and Mozilla 1.5 but they say they can't get my code to work any ideas whats wrong with it: <SCRIPT LANGUAGE="JavaScript"> // Row Hide function. function expandcontract(tbodyid,ClickIcon) { if (parent.document.getElementById(ClickIcon).innerHT ML == "+"){ parent.document.getElementById(tbodyid).style.disp lay = ""; parent.document.getElementById(ClickIcon).innerHTM L = "-"; } else { parent.document.getElementById(tbodyid).style.disp lay = "none"; parent.document.getElementById(ClickIcon).innerHTM L = "+"; }} </SCRIPT> <table border=1 cellpadding=4 CELLSPACING=0> <tr> <td onclick="expandcontract('Row1','ClickIcon1')" id="ClickIcon1" style="cursor: pointer; cursor: hand;">+</td> <td>ROW 1 - HEADER</td> </tr> <tbody id="Row1" style="display:none"> <tr><td colspan="2">ROW 1 SubDATA...</td></tr> <tr><td colspan="2">ROW 1 SubDATA1...</td></tr> </tbody> <tr> <td onclick="expandcontract('Row2','ClickIcon2')" id="ClickIcon2" style="cursor: pointer; cursor: hand;">+</td> <td>ROW 2 - HEADER</td></tr> <tbody id="Row2" style="display:none"> <tr><td colspan="2">ROW 2 SubDATA...</td></tr> <tr><td colspan="2">ROW 2 SubDATA1...</td></tr> </tbody></table> |
|
#2
|
|||
|
|||
|
Sorry this was a duplicate reply! Still understanding how this forum works
![]() Last edited by AliIbarguen : September 6th, 2004 at 03:56 PM. Reason: accidentally duplicated reply |
|
#3
|
|||
|
|||
|
You have spaces in the JavaScript - in the words 'innerHTML' and 'display'. I took those out and ran the code like a charm. Thanks, by the way. I was looking for a code snippet to do exactly that!
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Code question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|