473,657 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

show table rows

Hi all,
I am new in the world of javascript. Someone plz help me.
I have two tables containing 30 rows each. In first table there is
checkbox and in the second table there is radio buttons ahead each
row. If i select 5th & 6th row from first table then it should show
only the 5th & 6th row from the second table. The rows are same in
both table. Likewise the rows i select from first table should only
display from the second table..
plz help me..I want it very argent.

Thanks in advance...

May 15 '07 #1
11 1939
sanju wrote:
Hi all,
I am new in the world of javascript. Someone plz help me.
I have two tables containing 30 rows each. In first table there is
checkbox and in the second table there is radio buttons ahead each
row. If i select 5th & 6th row from first table then it should show
only the 5th & 6th row from the second table. The rows are same in
both table. Likewise the rows i select from first table should only
display from the second table..
plz help me..I want it very argent.

Thanks in advance...
Hi,

If you are really new to JavaScript, don't expect you'll solve your problem
with a posting to this ng.
The reason is simply that is will be difficult for anybody to help you if
you know nothing about javascript.

eg: Expect answers/questions like:
- Give every td an unique ID.
- what are the values in the radiogroup? and what is their name?
etc.

Probably all over your head and might very well result in a lot more
timeloss for you trying to understand what goes wrong.

The good news is: What you are asking for is very basic.
I would advise you to hire a JavaScript programmer for one day and fix your
app as you desire.
(s)he can probably also fix/build a few other things if any good in 1 day.
;-)
just my 2 cent.
Good luck.

Regards,
Erwin Moller
May 15 '07 #2
Erwin Moller wrote on 15 mei 2007 in comp.lang.javas cript:
sanju wrote:
>Hi all,
I am new in the world of javascript. Someone plz help me.
I have two tables containing 30 rows each. In first table there is
checkbox and in the second table there is radio buttons ahead each
row. If i select 5th & 6th row from first table then it should show
only the 5th & 6th row from the second table. The rows are same in
both table. Likewise the rows i select from first table should only
display from the second table..
plz help me..I want it very argent.

Thanks in advance...

Hi,

If you are really new to JavaScript, don't expect you'll solve your
problem with a posting to this ng.
The reason is simply that is will be difficult for anybody to help you
if you know nothing about javascript.
Another reason is that we don't do Sanju's school assignment.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 15 '07 #3
ASM
sanju a écrit :
Hi all,
I am new in the world of javascript. Someone plz help me.
I have two tables containing 30 rows each. In first table there is
checkbox and in the second table there is radio buttons ahead each
row. If i select 5th & 6th row from first table then it should show
only the 5th & 6th row from the second table. The rows are same in
both table. Likewise the rows i select from first table should only
display from the second table..
You must hide by JS each row of 2nd table

function hid() {
var t2 = document.getEle mentById('table 2');
t2 = t2.getElementsB yTagName('TBODY ')[0].rows;
for(var i=0; i<t2.length; i++)
t2[i].style.display = 'none';
}

Then you must to have a function to see what is checked

function chck() {
var C = new Array();
var k = 0;
var t1 = document.getEle mentById('table 2');
t1 = t1.getElementsB yTagName('TBODY ')[0].rows;
for(var i=0; i<t2.length; i++)
if(t2[i].getElementsByT agName('INPUT')[0].checked) {
C[k] = i;
k++;
}
return C;
}

And something to reveal correct rows :

function myRows() {
hid();
var C = chck();
var t2 = document.getEle mentById('table 2');
t2 = t2.getElementsB yTagName('TBODY ')[0].rows;
for(var i=0; i<C.length; i++)
t2[C[i]].style.display = '';
}

<html>
<script type="text/javascript">
var t1, t2;
function init() {
t1 = document.getEle mentById('table 1');
t1 = t1.getElementsB yTagName('TBODY ')[0].rows;
t2 = document.getEle mentById('table 2');
t2 = t2.getElementsB yTagName('TBODY ')[0].rows;
hid();
}
onload = init;

function hid() {
for(var i=0; i<t2.length; i++) {
t2[i].style.display = 'none';
t2[i].getElementsByT agName('INPUT')[0].checked=false;
}
}

function chck() {
var C = new Array();
var k = 0;
for(var i=0; i<t1.length; i++)
if(t1[i].getElementsByT agName('INPUT')[0].checked) {
C[k] = i;
k++;
}
return C;
}

function myRows() {
hid();
var C = chck();
for(var i=0; i<C.length; i++) {
t2[C[i]].style.display = '';
// t2[C[i]].getElementsByT agName('INPUT')[0].checked=true;
}
}

</script>
<form>
<table id="table1" border="1" width="90%" cellspacing="2" >
<tr>
<td><input type=checkbox onclick="myRows ()"></td>
<td>_Row_1_Cell _2_</td>
<td>_Row_1_Cell _3_</td>
</tr>
<tr>
<td><input type=checkbox onclick="myRows ()"></td>
<td>_Row_2_Cell _2_</td>
<td>_Row_2_Cell _3_</td>
</tr>
<tr>
<td><input type=checkbox onclick="myRows ()"></td>
<td>_Row_3_Cell _2_</td>
<td>_Row_3_Cell _3_</td>
</tr>
<tr>
<td><input type=checkbox onclick="myRows ()"></td>
<td>_Row_4_Cell _2_</td>
<td>_Row_4_Cell _3_</td>
</tr>
<tr>
<td><input type=checkbox onclick="myRows ()"></td>
<td>_Row_5_Cell _2_</td>
<td>_Row_5_Cell _3_</td>
</tr>
</table>

<table id="table2" border="1" width="90%" cellspacing="2" >
<tr>
<td><input type=radio name=rad></td>
<td>_Row_1_Cell _2_</td>
<td>_Row_1_Cell _3_</td>
</tr>
<tr>
<td><input type=radio name=rad></td>
<td>_Row_2_Cell _2_</td>
<td>_Row_2_Cell _3_</td>
</tr>
<tr>
<td><input type=radio name=rad></td>
<td>_Row_3_Cell _2_</td>
<td>_Row_3_Cell _3_</td>
</tr>
<tr>
<td><input type=radio name=rad></td>
<td>_Row_4_Cell _2_</td>
<td>_Row_4_Cell _3_</td>
</tr>
<tr>
<td><input type=radio name=rad></td>
<td>_Row_5_Cell _2_</td>
<td>_Row_5_Cell _3_</td>
</tr>
</table>
</form>
</html>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
May 15 '07 #4
Evertjan. wrote:
Erwin Moller wrote on 15 mei 2007 in comp.lang.javas cript:
>sanju wrote:
>>Hi all,
I am new in the world of javascript. Someone plz help me.
I have two tables containing 30 rows each. In first table there is
checkbox and in the second table there is radio buttons ahead each
row. If i select 5th & 6th row from first table then it should show
only the 5th & 6th row from the second table. The rows are same in
both table. Likewise the rows i select from first table should only
display from the second table..
plz help me..I want it very argent.

Thanks in advance...

Hi,

If you are really new to JavaScript, don't expect you'll solve your
problem with a posting to this ng.
The reason is simply that is will be difficult for anybody to help you
if you know nothing about javascript.

Another reason is that we don't do Sanju's school assignment.
LOL, yeah. ;-)
Could also be true.

BTW: ASM wrote a lengthy answer that looks good.
However, I wonder if the OP can use it...

Regards,
Erwin Moller
May 15 '07 #5
ASM
Erwin Moller a écrit :
>
BTW: ASM wrote a lengthy answer that looks good.
Tested in FF
However, I wonder if the OP can use it...
I certainly will not give commented code in first answer.
He will have to do it himself, showing by that he understand.

If he doesn't understand sg he'll can come back and ask.

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
May 15 '07 #6
ASM wrote:
Erwin Moller a écrit :
>>
BTW: ASM wrote a lengthy answer that looks good.

Tested in FF
>However, I wonder if the OP can use it...

I certainly will not give commented code in first answer.
He will have to do it himself, showing by that he understand.

If he doesn't understand sg he'll can come back and ask.
Looks like Sanju is too busy to check out your excellent answer...

Regards,
Erwin Moller
May 16 '07 #7
ASM
Erwin Moller a écrit :
ASM wrote:
>>
If he doesn't understand sg he'll can come back and ask.
He could : 1st part of what I've given is wrong (can't work)
Looks like Sanju is too busy to check out your excellent answer...
:-))

I do not wait something from those who question
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
May 16 '07 #8
On May 15, 7:27 pm, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
Erwin Moller wrote on 15 mei 2007 in comp.lang.javas cript:


sanju wrote:
Hi all,
I am new in the world of javascript. Someone plz help me.
I have two tables containing 30 rows each. In first table there is
checkbox and in the second table there is radio buttons ahead each
row. If i select 5th & 6th row from first table then it should show
only the 5th & 6th row from the second table. The rows are same in
both table. Likewise the rows i select from first table should only
display from the second table..
plz help me..I want it very argent.
Thanks in advance...
Hi,
If you are really new to JavaScript, don't expect you'll solve your
problem with a posting to this ng.
The reason is simply that is will be difficult for anybody to help you
if you know nothing about javascript.

Another reason is that we don't do Sanju's school assignment.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)- Hide quoted text -

- Show quoted text -
Dont act very smart!!!! r u owner of this group?
i dont like to give answer to ur foolish thing...dont think abt
me...think abt ur self, it will help u in future

May 17 '07 #9
sanju wrote on 17 mei 2007 in comp.lang.javas cript:
If you are really new to JavaScript, don't expect you'll solve your
problem with a posting to this ng.
The reason is simply that is will be difficult for anybody to help you
if you know nothing about javascript.

Another reason is that we don't do Sanju's school assignment.

Dont act very smart!!!! r u owner of this group?
i dont like to give answer to ur foolish thing...dont think abt
me...think abt ur self, it will help u in future
You seem to mistake usenet for sms, go and learn first, Sanju.
In your angryness you expose yourself.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 17 '07 #10

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

Similar topics

3
27137
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
7756
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
2569
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
2
7007
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
1953
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
8018
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.
2
7411
by: agphoto | last post by:
when we do mysql_query with while and mysql_num_rows() together then while do no show the first row from table in database.. example : <? $conn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database"); @mysql_select_db("$DBName") or die("Unable to select database $DBName"); $sqlquery = "SELECT * FROM $table WHERE opinion = 'is great'"; $result = mysql_query($sqlquery,$conn); $number = mysql_num_rows($result);...
18
7550
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...
2
11528
by: Sudhakar | last post by:
hi I am using MySQL - 4.1.22 when i use the following sql query $result = mysql_query("SHOW tablename STATUS FROM databasename;"); i have also tried = $result = mysql_query("SHOW tablename STATUS FROM databasename"); i get the following error message
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
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...
1
8518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6177
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
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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...
1
2743
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
1734
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.