显示/隐藏表格的行 [英] Show/hide rows of a table

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

问题描述

我一直在搜索这段时间而且找不到任何东西并且玩弄它让我无处可去。我将从我所追求的内容开始,然后解释我的内容。


我有一个包含3行和2列的表格。我希望页面加载只有一行可见,底部两行隐藏。我想要一个添加底部最可见行的按钮。当您点击添加按钮时按钮,它在底部添加一行,并将添加按钮移动到底行。我还想删除每行上的按钮以隐藏该特定行。删除按钮有效,因此您删除的任何行都会将行向上移动并添加添加按钮。按钮到最底部的行。


在加载时只有第一行可以使用:

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 add button to the bottom row. I would also like remove buttons on each row to hide that particular row. The remove button works so that any row you remove it shifts the rows up and adds an "add" button to the bottom most row.

Having only the first row visible on load is easy using:

展开 | 选择 | 换行 | 行号

推荐答案

为什么不在表格外面放置添加按钮并在达到最大行数后隐藏它。
Why not put the Add button outside the table and hide it once the maximum number of rows is reached.


很棒的主意。


现在我如何创建一个按钮来显示下一个隐藏的行,而不是仅显示我在创建按钮时指定的行。我猜测在JavaScript函数中需要一个变量,但我不是一个伟大的javascripter,或者可能有一个更简单的方法,我看到它比它更难。
Excellent idea.

Now how would I make a button to show the next hidden row instead of just showing the row I specify when creating the button. I am guessing there will need to be a variable in the JavaScript function but I am not a great javascripter, or perhaps there is an easier way and I am seeing it more difficult than it is.


它不应该太难。


使用当前行号保留一个全局变量。按添加按钮时,在显示下一行时递增此变量。
It shouldn''t be too difficult.

Keep a global variable with the current row no. When you press the Add button, increment this variable while showing the next row.


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

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