473,405 Members | 2,187 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.

Hide/Show Table Rows

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[i].cells[0].firstChild.checked) {
elem.removeChild(elem.rows[i]);
}
}
}
<% Do While Not rs.EOF %>
<tr>
<td><input type="checkbox"/></td>
</tr>
<%
rs.MoveNext
Loop
%>

<input type="button" value="Hide Checked Events"
onclick="removeEvents();"/>

Feb 10 '06 #1
3 1938

<ev*******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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[i].cells[0].firstChild.checked) {
elem.removeChild(elem.rows[i]);
}
}
}

How about this?

function displayEvents( show) {
var elem = document.getElementById("EventsBody");
for (var i = elem.rows.length-1; i >= 0 ; i--) {
if (elem.rows[i].cells[0].firstChild.checked) {
elem.rows[i].style.display = show ? "inline" : "none";
}
}
}
function hideEvents( ) {
displayEvents(false);
}

function showEvents( ) {
displayEvents(true);
}

Feb 11 '06 #2


Do not use .removeChild() method, as it nulls out the node, instead,
just set the .style.display='none' and then back to 'table-row' for
when you want to show them :).

Danny
Feb 11 '06 #3
Perfect! Thanks.

Feb 11 '06 #4

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

Similar topics

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...
2
by: Mark | last post by:
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...
9
by: Wang, Jay | last post by:
I try to group several rows in a table into a div and show/hide them by click on a button somewhere with a javascript link. When clicked, the link will toggle the style of the div section's style...
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...
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...
5
by: Dautkhanov | last post by:
Hello all ! I have my own library for web-design building - active forms, lists. I am going to build tabbing component. The complexity in this process is that all web forms uniformed and are...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...

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.