Show / Hide Table Rows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    Show / Hide Table Rows

    Hi,

    I need to be able to have five different links and when when someone
    clicks to show row 2, row 1 automatically hides. Right now all i can
    figure out is a link that will show but then you have to click the
    same link to hide. I want to be able to turn off a row when another
    row is clicked on to show?

    Can someone help?

    THanks
    Mark
  • kaeli

    #2
    Re: Show / Hide Table Rows

    In article <ea08cf5e.03102 01223.61b8d83e@ posting.google. com>,
    mark_becker@irc o.com enlightened us with...[color=blue]
    > Hi,
    >
    > I need to be able to have five different links and when when someone
    > clicks to show row 2, row 1 automatically hides. Right now all i can
    > figure out is a link that will show but then you have to click the
    > same link to hide. I want to be able to turn off a row when another
    > row is clicked on to show?
    >[/color]

    Put code to hide all non-hidden rows in the onclick that shows one row.

    If you id'd your rows right (that is, easy to loop through by calling
    them all the same with one char difference or such), this can be done in
    a simple loop.

    Say all your rows were "myRow_" and a number.

    <tr id="myRow_1" onClick="doIt(t his)">
    doIt would show the row and loop through and hide the other rows. Say
    you have 1-10 of them.

    function doIt(r)
    {
    if (! document.getEle mentById)
    {
    alert("error");
    return;
    }
    for (x=1; x<=10; x++)
    {
    e = document.getEle mentById("myRow _"+x);
    if (!e.style)
    {
    alert("error");
    break;
    }
    if (e == r) e.style.visibil ity = "visible";
    else e.style.visibil ity = "hidden";
    }
    }

    I'm tired and I didn't test this. Works in theory. Typos be darned. :)

    -------------------------------------------------
    ~kaeli~
    Jesus saves, Allah protects, and Cthulhu
    thinks you'd make a nice sandwich.


    -------------------------------------------------

    Comment

    • Louise Woodward

      #3
      Re: Show / Hide Table Rows

      Can you hide comboboxs using the style.display = "none"

      "kaeli" <infinite.possi bilities@NOSPAM att.net> wrote in message
      news:MPG.19fe06 e5dcd9c0c99898f 1@nntp.lucent.c om...[color=blue]
      > In article <ea08cf5e.03102 01223.61b8d83e@ posting.google. com>,
      > mark_becker@irc o.com enlightened us with...[color=green]
      > > Hi,
      > >
      > > I need to be able to have five different links and when when someone
      > > clicks to show row 2, row 1 automatically hides. Right now all i can
      > > figure out is a link that will show but then you have to click the
      > > same link to hide. I want to be able to turn off a row when another
      > > row is clicked on to show?
      > >[/color]
      >
      > Put code to hide all non-hidden rows in the onclick that shows one row.
      >
      > If you id'd your rows right (that is, easy to loop through by calling
      > them all the same with one char difference or such), this can be done in
      > a simple loop.
      >
      > Say all your rows were "myRow_" and a number.
      >
      > <tr id="myRow_1" onClick="doIt(t his)">
      > doIt would show the row and loop through and hide the other rows. Say
      > you have 1-10 of them.
      >
      > function doIt(r)
      > {
      > if (! document.getEle mentById)
      > {
      > alert("error");
      > return;
      > }
      > for (x=1; x<=10; x++)
      > {
      > e = document.getEle mentById("myRow _"+x);
      > if (!e.style)
      > {
      > alert("error");
      > break;
      > }
      > if (e == r) e.style.visibil ity = "visible";
      > else e.style.visibil ity = "hidden";
      > }
      > }
      >
      > I'm tired and I didn't test this. Works in theory. Typos be darned. :)
      >
      > -------------------------------------------------
      > ~kaeli~
      > Jesus saves, Allah protects, and Cthulhu
      > thinks you'd make a nice sandwich.
      > http://www.ipwebdesign.net/wildAtHeart
      > http://www.ipwebdesign.net/kaelisSpace
      > -------------------------------------------------[/color]


      Comment

      Working...