![]() Topic awaiting preservation: show/hide a table row (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: New Jersey, USA |
![]() I have an example of what I'm trying to do here and it works fine in IE but really screws the pooch in Firefox. I've tried the few different things that my limited javascript knowledge will allow so I'm here to ask you guys. code: <script language="javascript"> <!-- var state = 'none'; function showhide(layer_ref) { if (state == 'inline') { state = 'none'; } else { state = 'inline'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.display = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].display = state; } if (document.getElementById &&!document.all) { hza = document.getElementById(layer_ref); hza.style.display = state; } } //--> </script>
code: <td><a href="#" onclick="showhide('div1');">Show/Hide</a></td> </tr> <tr id="div1" style="display: none;"> <td colspan="4"> <table width="100%" border="1"> <tr> <th width="50%">Answer Text</th> <th width="25%">Answer Type</th> <th width="25%">Edit Answer</th> </tr> <tr> <td>Under 18</td> <td>Answer Type = 0</td> <td><a href="/admin/index.php?action=editAnswer&id=1">Edit Answer</a></td> <tr> <td>18 - 21</td> <td>Answer Type = 0</td> <td><a href="/admin/index.php?action=editAnswer&id=2">Edit Answer</a></td> <tr> <td>21 - 30</td> <td>Answer Type = 0</td> <td><a href="/admin/index.php?action=editAnswer&id=3">Edit Answer</a></td> <tr> <td>31 - 40</td> <td>Answer Type = 0</td> <td><a href="/admin/index.php?action=editAnswer&id=4">Edit Answer</a></td> </tr> </table>
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() This page works fine with me: code: if (state == 'inline') { state = 'none'; } else { state = 'inline'; }
code: state = ( state == 'inline') ? 'none':'inline';
|
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() Table rows, cells, etc have different display types: |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() Thanks for the help guys. |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() I was right about 1 thing... There was a simple statement to do the job and between your 2 posts the answer was there right in front of me. code: function showHide(id,vis) { var val; val = (vis != 'none')?'none':((document.all && !window.opera)?'inline':'table-row'); document.getElementById('div'+id).style.display = val; }
|