使用 Tab 键导航表单输入

发布于 2024-08-13 15:55:11 字数 640 浏览 1 评论 0 原文

我在 ASP.NET 页面中使用 Tab 键时遇到一些问题。该项目是使用 Visual Studio 2008 开发的。

案例 1

我有两个 html 表。第一个表有两行;第二个表有四行。每个表的单元格内都有 ASP.NET 字段、文本框和单选按钮列表。我将焦点设置在表一的第一个字段上。然后我多次按 Tab 键。焦点将移过表一的字段,然后移过表二第一行的字段。然后,它返回到表一,而不是转到表二的第二行。

但是,如果我将焦点设置到表二第一行的最后一个单元格,它会正确浏览表二的其余单元格。您能告诉我如何让选项卡正常运行并按自然顺序进入单元格吗?请注意,我按照我想要的顺序设置选项卡索引属性。

案例 2

在另一个页面上,我有一个 html 表格,其中有一行,后面跟着一个 gridview 控件。 gridview 控件是可写的,具有以下列:复选框、单选按钮列表、文本框、文本框、文本框和复选框列表。如果我单击复选框、单选按钮列表或复选框列表之一,然后按 Tab,光标会从网格中弹出,并将焦点设置在网格外表格的第一个字段上。但是,如果我将焦点集中在其中一个文本框和选项卡上;然后该选项卡一次从左到右浏览网格的字段一行。在这两种情况下,后面的行为都是我想要的。我不知道当我从文本框以外的字段开始时,为什么我的光标会从网格中弹出。

如果可以的话请帮忙。

鲍勃

I am having some problems with tabbing within my asp.net pages. This project was developed with Visual Studio 2008.

Case 1

I have two html tables. The first table has two rows; the second table has four rows. Within the cells are of each table are asp.net fields, text boxes and radio button lists. I set focus to the first field of table one. I then press the tab key multiple times. The focus moves through the field of table one and then through the fields in the first row of the table two. Then instead of goes to the second row of the table two it return to the table one.

But if I set focus to the last cell on the first row of table two, it tabs through the remaining cells of table two properly. Can you tell me how to get the tabbing to behave properly and go to the cells in there natural order? Note that I am setting the tab index property in the order that I want.

Case 2

On another page I have an html table with a single row followed by a gridview control. The gridview control is writeable and has the following columns: Check Box, Radio Button List, Text Box, Text Box, Text Box and a Check Box List. If I click on one of Check Box, Radio Button List or Check Box List., then press tab, the cursor pops out of the grid and sets focus on the first field of the table outside the grid. But if I set focus on one of the text boxes and tab; then the tab goes through the fields of the grid left to right one row at a time. This later behavior is what I want in both cases. I don’t know why my cursor pops out of the grid when I start with a field other than a text box.

Please help if you can.

Bob

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

甚是思念 2024-08-20 15:55:11

有趣的是,您详细解释了您的情况,但您没有解释需要解释什么才能让别人理解您:)

首先,table1 是否位于第一个选项卡中,table2 位于第二个选项卡中?
您使用什么选项卡:asp.net 选项卡控件、jquery ui 选项卡...?
“多次按 Tab 键”是什么意思?相同的选项卡?您有选项卡点击后的回发吗?你的案例的重点是什么,等等......

干杯

funny, you explain in details your case but you didn't explain what it needs to be explained in order to someone can understand you :)

first of all, is table1 located in the first tab and table2 in second tab?
what do you used for tabs: asp.net tab control, jquery ui tabs...?
what do you mean by 'press the tab key multiple times'? same tab? do you have postback on tab click? what is the focus in your case, and so on and on...

cheers

望她远 2024-08-20 15:55:11

您检查过 HTML 中输入元素的顺序吗?通常,Tab 顺序遵循控件的顺序。

如果一切看起来都正确,请确保没有设置 TabIndex 属性 - 因为这也会打乱 Tab 键顺序。

Have you checked the order of the input elements in your HTML? Generally the tab order follows the order of controls.

If that all looks right, then make sure nothing is setting the TabIndex property - as this will also mess up the tab order.

热风软妹 2024-08-20 15:55:11

我几乎解决了这个问题,我想为查看此帖子的任何人添加答案。问题是某些字段的自动回发。一旦我禁用自动回发,问题就消失了。

鲍勃

I pretty much resolve this and I wanted to add the answer for anyone who viewed this thread. The problem was the autpostback on certain fields. Once I disabled autopostback, the problems went away.

Bob

硬不硬你别怂 2024-08-20 15:55:11

您需要使用 Javascript,我为您推荐了一个使用向上/向下键浏览 Gridview 行的非常好的示例。

http://www.codeproject.com /Articles/25675/GridView-Rows-Navigation-使用向上箭头键

You need to use Javascript and I referred for your a very good example of navigating through Gridview rows with Up/Down keys.

http://www.codeproject.com/Articles/25675/GridView-Rows-Navigation-Using-Arrow-Up-Down-Keys

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文