473,699 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

"kaeli" <in************ ********@NOSPAM att.net> wrote in message
news:MP******** *************** *@nntp.lucent.c om...
In article <ea************ **************@ posting.google. com>,
ma*********@irc o.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(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
-------------------------------------------------

Jul 20 '05 #3

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

Similar topics

3
27140
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 have a button to drill down i.e which displays X number of rows with results that make up the summary row value. When "drilled down" also provide a button to "collapse" the detail rows! Is it possible to show/hide individual rows in a table? -...
3
7768
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 though I have one set to style="display='none'". When I click on the Edit button on a row, I want to hide that row and in its PHYSICAL place show the ForEdit div for that item...leaving all other divs as is. I've seen some examples, everyone seems...
20
2582
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 selected ones visible. At the moment, I am doing it as follows: www.corstorphinehouse.com/d/avail.html
10
4649
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 with the javascript in a toggle fashion. the problem is a know very little javascript and have become incredibly frustrated because i went ahead thinking it was going to be like C. its not. I know i can use these lines to do the actual work:
2
7010
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 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
3
1956
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 removeEvents( ) { var elem = document.getElementById("EventsBody"); for (var i = elem.rows.length-1; i >= 0 ; i--) { if (elem.rows.cells.firstChild.checked) { elem.removeChild(elem.rows); }
11
8063
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 display. If they put a value in the text box in the second row then display the third row etc. etc. etc. to 10 rows. I'm pretty new to javascript, so I'm not to sure where to start. Any help would be great, thanks a lot.
1
7411
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 HIDE button is clicked, I need to hide all the table rows which contain UNCHECKED textboxes. When the SHOW button is clicked, I want to restore the visibility of all the rows. I need to do this in JavaScript (which is what I'm having trouble with)...
18
7560
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 rows and 2 columns. I would like on page load to only have one row visible with the bottom two rows hidden. I would like to have an "add" button on the bottom most visible row. When you click the "add" button it adds a row to the bottom and moves the...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.