Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with hiding cells in IE but works in Firefox 1

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
I have tables inside tables and I am collapsing the cell that contains these tables, it works perfectly in firefox, but I can't seem to find the problem when I use IE or Opera to test it, it doesn't collapse / expand the cell like FF does.

Regards,
Jason



Code:
<script language="javascript">
function openreply(row_id) {
if(document.getElementById(row_id).style.display=="none") {
document.getElementById(row_id).style.display="";

} else {
document.getElementById(row_id).style.display="none";
}
}
</script>


Code:
<tr>
  <td width="119" height="53" class="bgw Rline" valign="top"><br />
    <div align="center"><span class="user">message</span></div></td>
  <td colspan="3" valign="top"  class="mt post"><br>
    <table width='98%' border='0' cellspacing='0' cellpadding='4'>
      <tr>
        <td class='Bline Rline Tline Lline bge quoting'><a name='quotequote25112319' id='hi'></a>Quote by snowboarder on 3/9/2006 12:27:57 AM
          <div align='right'><a class='smll' href='#quotequote25112319' onClick="openreply('quotequote25112319');">Show -/+ Hide</a></div></td>
      </tr>
      <tr id='quotequote25112319'>
        <td class='Bline Rline Lline bgw mt'><br>
          <table width='98%' border='0' cellspacing='0' cellpadding='4'>
            <tr>
              <td class='Bline Rline Tline Lline bge quoting'><a name='quotequote24957279' id='hi'></a>Quote by snowboarder on 3/9/2006 12:26:52 AM
                <div align='right'><a class='smll' href='#quotequote24957279' onClick="openreply('quotequote24957279');"></a></div></td>
            </tr>
            <tr id='quotequote24957279'>
              <td class='Bline Rline Lline bgw mt'><br>
                <table width='98%' border='0' cellspacing='0' cellpadding='4'>
                  <tr>
                    <td class='Bline Rline Tline Lline bge quoting'><a name='quotequote24852269' id='hi'></a>ra</td>
                  </tr>
                </table>
                <br>
                <br>
                test</td>
            </tr>
          </table>
          <br>
          <br>
          message</td>
      </tr>
    </table>
    <br>
    <br>
    message</td>
</tr>
</table>
<br>
<br>
message
</td>
</tr>
 
It's probably because your table structure is bad. You have one too many closing TD, TR, and TABLE tag for the number of opening tags. I suspect you have missed out some closing tags after the first quote table.

It's easier to spot these things if you indent your code more regularly (i.e. inside each td, for example).

Perhaps you can fix your table structure and post if it still doesn't work?

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hmm.. OK - the suggestion above will not fix the problem, although you should fix your table markup anyway. The problem seems to be that IE erroneously finds the anchor with the same name as the ID of the row, and baulks.

Change this:

Code:
<a name='quotequote25112319' id='hi'></a>

to this:

Code:
<a name='quotequote25112319_anchor' id='hi'></a>
and it all works.

Note, you have multiple uses of the id "hi", which is also invalid markup. You should validate your pages after you've fixed the table structure to make sure you get rid of all these minor issues.

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
haha thanks alot! I probably would have never thought it would be that :) Good eye Dan. I am sure you never get the chance to actually see what you have helped fix so I uploaded a screenshot of what you help me fix... its a forum I am working on its the Show -/+ hide feature for quotes.


Regards,
Jason

ps. Ya my html is kind of screwed up on those tables, but thats because I output it server-side, so the formating is off. - will look into it further

Site San Diego www.sitesd.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top