ainoy31 Posted April 29, 2009 Share Posted April 29, 2009 I need to show and hide data rows in my table. Here is my code: This is the javascript code: function toggle(id) { //document.write(id); var state = document.getElementById(id).style.display; if(state == 'block') { document.getElementById(id).style.display = 'none'; } else { document.getElementById(id).style.display = 'block'; } } <table class="tableresult"> <tr valign="TOP" align="left" nowrap="nowrap"> <th nowrap="nowrap"> </th> <th nowrap="nowrap">Database</th> <th nowrap="nowrap">Table</th> </tr> <?php for($j=0; $j<count($results); $j++){ ?> <tr valign="TOP" align="left" nowrap="nowrap"> <td class="done"><input type="checkbox" onclick="toggle('<?=$j?>');"></td> <td class="done"><?php print $results[$j]->database ?></td> <td class="done"><?php print $results[$j]->table ?></td> </tr> <tr><td> <tr id="<?=$j;?>" style="display: none;"> <? foreach($results[$j]->info as $key => $value) { ?> <td style="background-color: #95FE3F;"><?=$key;?></td> <td style="background-color: #95FE3F;"><?=$value;?></td> <td style="background-color: #95FE3F;"> </td> <?}?> </tr> </td></tr> <?php } ?> </table> I have attached a screen shot of what displays in the bad_display.jpg. I have attached another screen shot to display what it is suppose to look like. I have been playing with this and no luck. Much appreciation. AM [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/156129-solved-displaying-table-issue/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.