SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Jun 2004
    Location
    UK
    Posts
    605
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hide contents of tr

    Hi,

    The following works in IE but not in Firefox:

    Code:
    <a href="#" onclick="document.getElementById('tablerow').style.display='block'">Show contents</a><br />
    <a href="#" onclick="document.getElementById('tablerow').style.display='none'">Hide contents</a>
    <table width="400">
    <tr id="tablerow">
    <td>Contents of table row<td>
    </tr>
    </table>

    Does anyone know how to get this to work in Firefox?


    Thanks for any pointers...

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Guru
    Join Date
    Jun 2004
    Location
    UK
    Posts
    605
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Kravvitz.

    Some of that scripting was slightly over my head, but I got the principal.

    This works:

    Code:
    <a href="#" onclick="document.getElementById('tablerow').style.display=''">Show contents</a><br />
    <a href="#" onclick="document.getElementById('tablerow').style.display='none'">Hide contents</a>
    <table width="400">
    <tr id="tablerow">
    <td>Contents of table row<td>
    </tr>
    </table>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •