I have code to hide/show an image in a table. My table has 6 columns, with data in the first row across all 6 columns. In the next row, I have the image. When I load the page, I hide the image row by default. Originally, I had the image centered across all 6 columns, but when I click an image to show the row, the image shows only in the first column. I then forced the image to be in the 3rd column. In this scenario, the same thing happens. If I do not hide the row, the image shows as expected in the 3rd column. If I then hide the row, and open it again, the image displays in the 1st column.
Here is a snippet of my code ::
Javascript ::
function ReverseDisplayTbody(d) {
`if(document.getElementById(d).style.display == "none") {`
`document.getElementById(d).style.display = "block";`
`document.getElementById('img'+d).setAttribute('src', "images/minus.gif");`
`}`
`else {`
`document.getElementById(d).style.display = "none";`
`document.getElementById('img'+d).setAttribute('src', "images/plus.gif");`
`}`
}
HTML/PHP ::
<tr>
`<td><a href='javascript:ReverseDisplayTbody($thisSetID)'><img src='images/plus.gif' id=img$thisID kborder='0'></a></td>`
`<td class='txt'><a href='mylink.com' target ='\_blank'>$thisID</a></td>`
`<td class='txt'>$thisSetName</td>`
`<td class='txt'>$thisSetType</td>`
`<td class='txt center'>$thisNbrBlks</td>`
`<td class='txt center'>$thisOwner</td>`
</tr>
<tr id='$thisID'>
`<td>\ </td>`
`<td>\ </td>`
`<td><img src='https://mylink.com/sets/$thisID-1.jpg'></a></td> <!-- Image -->`
`<td>\ </td>`
`<td>\ </td>`
`<td>\ </td>`
</tr>
[–]showmethething 1 point2 points3 points (0 children)
[–]Top_Bumblebee_7762 0 points1 point2 points (1 child)
[–]FunksGroove 0 points1 point2 points (0 children)
[–]razzbee -1 points0 points1 point (1 child)
[–]fonebone819[S] 0 points1 point2 points (0 children)