Show/hide table

Discussion in 'Javascript' started by Mateo, Oct 25, 2005.

  1. Mateo

    Mateo Guest

    Hi!

    I have a litle JS problem.... I'm trying to make show/hide table JS
    function, but my show/hide table
    function works only on IE.... It works in mozilla partially. Actually,every
    time when I contract table the empty
    field is left.

    You can see example in left side menu on www.kijevo.hr when you click on
    plus or minus. If you
    access page from mozilla you will se the problem... From IE it works just
    fine...


    For show/hide efect I used style.display = 'block'; and style.display =
    'none';
    (I didn't actually wrote function, I adapted it)

    Here is code:
    function showtrPV( row) {

    var strTable = 'tblUslugaSH';

    var strIMG = 'imgSH';

    if (document.getElementById(strTable).rows[1].style.display == 'none') {

    document.getElementById(strIMG).src = 'Pictures/minus.gif';

    document.getElementById(strTable).rows[1].style.display = 'block';

    eval("lblRoomTypeCrta" + nRedniBrojUsluge + ".style.visibility =
    'hidden'" + ";");

    }

    else {

    document.getElementById(strIMG).src = 'Pictures/plus.gif';

    document.getElementById(strTable).rows[1].style.display = 'none';

    eval("lblRoomTypeCrta" + nRedniBrojUsluge + ".style.visibility = ''"
    + ";");

    }

    }




    Thanks!
    Mateo, Oct 25, 2005
    #1
    1. Advertising

  2. Mateo wrote:

    > I have a litle JS problem.... I'm trying to make show/hide table JS
    > function, but my show/hide table function works only on IE


    As of CSS 2, table rows default to "display: table-row". If you set them to
    "display: block" then they won't act like table rows any more.

    Toggle the style.display property between "none" and "" instead of "none"
    and "block".

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Oct 25, 2005
    #2
    1. Advertising

  3. Mateo

    Mateo Guest

    Thx man!

    U solved my problem! U Rock!

    Mateo P.

    "David Dorward" <> wrote in message
    news:djm252$ltf$1$...
    > Mateo wrote:
    >
    > > I have a litle JS problem.... I'm trying to make show/hide table JS
    > > function, but my show/hide table function works only on IE

    >
    > As of CSS 2, table rows default to "display: table-row". If you set them

    to
    > "display: block" then they won't act like table rows any more.
    >
    > Toggle the style.display property between "none" and "" instead of "none"
    > and "block".
    >
    > --
    > David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    > Home is where the ~/.bashrc is
    Mateo, Oct 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RA
    Replies:
    1
    Views:
    3,969
  2. Noozer

    Hide/Show table columns?

    Noozer, Dec 1, 2004, in forum: HTML
    Replies:
    3
    Views:
    26,004
    Nik Coughlin
    Dec 1, 2004
  3. Susanne West
    Replies:
    4
    Views:
    1,345
    Susanne West
    Nov 15, 2006
  4. Replies:
    6
    Views:
    216
  5. ll
    Replies:
    2
    Views:
    640
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page