显示表行 [英] show table rows

查看:62
本文介绍了显示表行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是javascript世界的新手。有人帮助我。

我有两个表,每个包含30行。在第一个表格中有

复选框,在第二个表格中,每个

行前面都有单选按钮。如果我选择5th&从第一张桌子排第6行然后它应该显示

只有第5和第5第二个表的第6行。

两个表中的行相同。同样,我从第一张桌子中选择的行应该只显示第二张桌子上的
..

plz帮帮我..我想要它非常银色。


提前致谢...

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...

推荐答案

sanju写道:
sanju wrote:

大家好,

我是javascript世界的新手。有人帮助我。

我有两个表,每个包含30行。在第一个表格中有

复选框,在第二个表格中,每个

行前面都有单选按钮。如果我选择5th&从第一张桌子排第6行然后它应该显示

只有第5和第5第二个表的第6行。

两个表中的行相同。同样,我从第一张桌子中选择的行应该只显示第二张桌子上的
..

plz帮帮我..我想要它非常银色。


在此先感谢...
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...



您好,


如果您真的不熟悉JavaScript,不要指望你会解决你的问题

发布到这个ng。

原因很简单,任何人都很难帮助你

你对javascript一无所知。


例如:期待答案/问题如:

- 给每个td一个唯一的ID。

- 无线电组中的值是多少?什么是他们的名字?




可能你的头脑很多,可能会产生更多的结果

时间损失让你试图了解出了什么问题。


好​​消息是:你要求的是非常基本的。

我会建议你雇用一个JavaScript程序员一天,并根据需要修复你的

应用程序。

(s)他可能还可以修复/构建一些其他东西,如果1天内有任何好处。

;-)

只需2美元。

祝你好运。


问候,

Erwin Moller

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


Erwin Moller于2015年15月在comp.lang.javascript写了
Erwin Moller wrote on 15 mei 2007 in comp.lang.javascript:

sanju写道:
sanju wrote:

>大家好,
我是javascript世界的新手。有人帮助我。
我有两个表,每个表包含30行。在第一个表格中有
复选框,在第二个表格中,每个
行前面都有单选按钮。如果我选择5th&从第一张桌子排第6行然后它应该只显示第5行&第二个表的第6行。
两个表中的行相同。同样,我从第一张桌子中选择的行应该只显示在第二张桌子上。
PLZ帮助我......我非常想要它。

提前致谢...
>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...






如果你真的是JavaScript新手,不要指望你会解决你的问题br />
发布到此ng的问题。

原因很简单,任何人都很难帮助你

如果你对此一无所知javascript。


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.



另一个原因是我们不做Sanju的学校作业。


-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)

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)


sanjuaécrit:
sanju a écrit :

大家好,

我是javascript世界的新手。有人帮助我。

我有两个表,每个包含30行。在第一个表格中有

复选框,在第二个表格中,每个

行前面都有单选按钮。如果我选择5th&从第一张桌子排第6行然后它应该显示

只有第5和第5第二个表的第6行。

两个表中的行相同。同样,我从第一个表中选择的行应该只显示第二个表中的
..
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..



你必须通过JS隐藏每一行第二行表


函数hid(){

var t2 = document.getElementById(''table2'');

t2 = t2.getElementsByTagName(''TBODY'')[0] .rows;

for(var i = 0; i< t2.length; i ++)

t2 [i ] .style.display =''none'';

}


然后你必须要有一个功能来查看检查的内容


函数chck(){

var C = new Array();

var k = 0;

var t1 = document.getElementById(''table2'');

t1 = t1.getElementsByTagName(''TBODY'')[0] .rows;

for(var i = 0; i< t2.length; i ++)

if(t2 [i] .getElementsByTagName(''INPUT'')[0] .checked){

C [k] = i;

k ++;

}

返回C;

}


还有什么可以揭示正确的ro ws:


函数myRows(){

hid();

var C = chck();

var t2 = document.getElementById(''table2'');

t2 = t2.getElementsByTagName(''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.getElementById(''table1'');

t1 = t1.getElementsByTagName(''TBODY'')[0] .rows;

t2 = document.getElementById(''table2'');

t2 = t2.getElementsByTagName(''TBODY'')[0] .rows;

hid();

}

onload = init;


function hid(){

for(var i = 0; i< t2.length; i ++){

t2 [i] .style.display =''none'';

t2 [ i] .getElementsByTagName(''INPUT'')[0] .checked = false;

}

}


函数chck(){

var C = new Array();

var k = 0;

for(var i = 0; i< t1.length; i ++)

if(t1 [i] .getElementsByTagName(''INPUT'')[0] .checked){

C [k] = i ;

k ++;

}

返回C;

}


函数myRows(){

hid();

var C = chck();

for(var i = 0; I< C.length; i ++){

t2 [C [i]]。style.display ='''';

// t2 [C [i]]。getElementsByTagName('' INPUT'')[0] .checked = true;

}

}


< / script>

< form>

< table id =" table1"边界=" 1 QUOT;宽度= QUOT; 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 =复选框onclick =" myRows()">< / td>

< td> _Row_5_Cell_2_< / td>

< td> _Row_5_Cell_3_< / td> ;

< / tr>

< / table>


< table id =" table2"边界=" 1 QUOT;宽度= QUOT; 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)vieuxMacdéjàdépassé

Stephane Moriaux和他的(较少)旧Mac已经过时

You must hide by JS each row of 2nd table

function hid() {
var t2 = document.getElementById(''table2'');
t2 = t2.getElementsByTagName(''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.getElementById(''table2'');
t1 = t1.getElementsByTagName(''TBODY'')[0].rows;
for(var i=0; i<t2.length; i++)
if(t2[i].getElementsByTagName(''INPUT'')[0].checked) {
C[k] = i;
k++;
}
return C;
}

And something to reveal correct rows :

function myRows() {
hid();
var C = chck();
var t2 = document.getElementById(''table2'');
t2 = t2.getElementsByTagName(''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.getElementById(''table1'');
t1 = t1.getElementsByTagName(''TBODY'')[0].rows;
t2 = document.getElementById(''table2'');
t2 = t2.getElementsByTagName(''TBODY'')[0].rows;
hid();
}
onload = init;

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

function chck() {
var C = new Array();
var k = 0;
for(var i=0; i<t1.length; i++)
if(t1[i].getElementsByTagName(''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]].getElementsByTagName(''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


这篇关于显示表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆