Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Show / Hide Table Rows

Reply
Thread Tools

Show / Hide Table Rows

 
 
Mark
Guest
Posts: n/a
 
      10-20-2003
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
 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      10-20-2003
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) enlightened us with...
> 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?
>


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(this)">
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.getElementById)
{
alert("error");
return;
}
for (x=1; x<=10; x++)
{
e = document.getElementById("myRow_"+x);
if (!e.style)
{
alert("error");
break;
}
if (e == r) e.style.visibility = "visible";
else e.style.visibility = "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
-------------------------------------------------
 
Reply With Quote
 
 
 
 
Louise Woodward
Guest
Posts: n/a
 
      10-23-2003
Can you hide comboboxs using the style.display = "none"

"kaeli" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In article <(E-Mail Removed) >,
> (E-Mail Removed) enlightened us with...
> > 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?
> >

>
> 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(this)">
> 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.getElementById)
> {
> alert("error");
> return;
> }
> for (x=1; x<=10; x++)
> {
> e = document.getElementById("myRow_"+x);
> if (!e.style)
> {
> alert("error");
> break;
> }
> if (e == r) e.style.visibility = "visible";
> else e.style.visibility = "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
> -------------------------------------------------



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Hide Table(s), Rows & Cells w/out a postback JDP@Work ASP .Net Web Controls 0 04-20-2006 03:32 PM
Hide/Show Table Rows evanburen@gmail.com Javascript 3 02-11-2006 04:08 AM
How to hide table rows and show them when user click a different row? RA ASP .Net 1 02-19-2004 10:53 PM
Show/hide table rows -- parameter undefined error? KathyB Javascript 2 09-29-2003 06:12 PM
Dynamically Show/Hide table rows? Harry Javascript 3 09-03-2003 06:15 PM



Advertisments