Jump to content

Recommended Posts

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.