SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    bug in Firefox???

    Hello,
    I have a js function that is triggered with the onclick event. In particular, there is a <tr> in a table that is shown when the user clicks on the "Show" button.

    In HTML I have:
    Code:
    <tr>  <td>
        <img id="myimage" src="css/images/show.png"           onclick="javascript:HideShow('myrow');"/>
       </td>
    </tr><tr id="myrow" style="display:none">
          <td>Hello all!
          </td>
    </tr>
    and the JS part is:

    Code:
    <script type="text/javascript">
    function HideShow(myVar)
              {
                    if (document.getElementById(myVar).style.display == 'none')
                    {
                        document.getElementById(myVar).style.display = 'inline'
                    }
                    else
                    {
                        document.getElementById(myVar).style.display = 'none'
                    }
              }
    </script>
    The function works fine, that is, when the user clicks on the image, the tr appears and then, if the user clicks again, it disappears... BUT all these work perfectly with IE, whereas in Firefox, the contents of the tr appear and disappear when the image is clicked, however, when the user clicks twice, the "Hello world" data disappears, but a blank row remains...And, if you do that again and again, I end up with as much blank rows as the times that I click the button for the data to disappear...

    Is this something like a bug? Can I do anything else?

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Instead of display = 'inline', try display = '' (default display value).

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Table rows should generate table row boxes, not inline boxes. The correct display value to use would be table-row, but that's not supported by IE≤7, so using an empty string as Raffles suggested is probably best.

    As usual, the bug isn't in Firefox, but in IE which incorrectly displays a table row as a table row although it's been instructed to display it as an inline box. IE seems to have hardcoded display values for certain element types (internal table objects, list items, etc.) and disregards any value other than none.
    Birnam wood is come to Dunsinane


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
  •