473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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
Jul 20 '05 #1
2 8196
In article <ea**************************@posting.google.com >,
ma*********@irco.com 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
-------------------------------------------------
Jul 20 '05 #2
Can you hide comboboxs using the style.display = "none"

"kaeli" <in********************@NOSPAMatt.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <ea**************************@posting.google.com >,
ma*********@irco.com 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
-------------------------------------------------

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Harry | last post by:
I want to provide a drill down facility for the users - the plan is to intially display a table with summary rows containing results of previous selected search criteria. In each summary row you...
3
by: KathyB | last post by:
Hi, totally new to the div show/hide thing. I have some rows in a table. When I first load the page, I only want to see divs where the divID=ForView. When I load now, I see BOTH rows...even...
20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
10
by: oLE | last post by:
I would like to add some javascript to show/hide a certain row of a table. The first row of the table contain the hyperlink that calls the javascript the second row is the one i want to show/hide...
2
by: Mateo | last post by:
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...
3
by: evanburen | last post by:
I'm using this to hide rows in a table created from ASP. This works well but I would like to also be able to 'Show' the records again that there hidden by removeEvents( ). Thanks. function...
11
by: jimstruckster | last post by:
I have a table with 10 rows, I want all rows except for the first to be hidden when the page first opens up. If the user puts a value in a text box in the first row then I want the second row to...
1
by: jbreaker | last post by:
Hi - I have a table with about 30 rows, which contain a checkbox and a bit of text each. What I'm trying to find a way to do is to have 2 buttons at the bottom of the page - HIDE & SHOW. When the...
18
by: Liquidtouch | last post by:
I have been searching on this for awhile and cant find anything and playing around with it got me no where. I will start with what I am after and then explain what I have. I have a table with 3...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.