Firefox 单选按钮怪异

发布于 2024-08-08 15:44:42 字数 746 浏览 6 评论 0原文

我有一个包含很多无线电组的表格。每个无线电都有一个唯一的 ID,并且与其组中的其他无线电具有相同的名称。该页面验证为 XHTML 过渡页面。

在 IE6 和 IE6 中测试7、Opera、Safari 和 Chrome,它的工作方式与您想象的通过鼠标或键盘输入完全一样。

在 FireFox 中,它变得疯狂。单击组中的任何收音机即可设置选中的组中的第一个收音机。双击收音机通常会选择它。有人以前见过这个吗?

示例组如下所示:

<input type="radio" name="upAndDown_1" id="upAndDown_11" value="Y"  /> Y <br />
<input type="radio" name="upAndDown_1" id="upAndDown_12" value="N"  checked="checked" /> N<br />
<input type="radio" name="upAndDown_1" id="upAndDown_13" value="NA"  /> NA

可以在此处测试声音: http://www.nolaflash.com/ stackoverflow/firefox_and_radios.html

任何建议表示赞赏。

I have a form with a lot of groups of radios. Each radio has a unique id and has the same name as the others in its group. The page validates as XHTML transitional.

Tested in IE6 & 7, Opera, Safari, and Chrome it works exactly as you would think it would from either mouse or keyboard input.

In FireFox it goes crazy. A single click on any radio in a group sets the first radio in the group checked. A double click on a radio usually selects it. Anyone seen this before?

Sample group looks like this:

<input type="radio" name="upAndDown_1" id="upAndDown_11" value="Y"  /> Y <br />
<input type="radio" name="upAndDown_1" id="upAndDown_12" value="N"  checked="checked" /> N<br />
<input type="radio" name="upAndDown_1" id="upAndDown_13" value="NA"  /> NA

The phonmomenon can be tested here: http://www.nolaflash.com/stackoverflow/firefox_and_radios.html

Any advice appreciated.

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

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

发布评论

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

评论(2

窝囊感情。 2024-08-15 15:44:42

哎哟!我的设计师用一个标签包裹着每组收音机。消除 label 标签可以解决 FireFox 的怪异问题。

Doh! My designer had a single tag wrapping each group of radios. Eliminating the label tag fixes FireFox's weirdness.

把时间冻结 2024-08-15 15:44:42

确实是周围的 标签导致了 Firefox 问题(尽管它是有效的 html)。
这应该可以解决问题:

<input type="radio" name="upAndDown_2" id="upAndDown_21" value="Y"/><label for="upAndDown_21">Y</label><br/>
<input type="radio" name="upAndDown_2" id="upAndDown_22" value="N"/><label for="upAndDown_22">N</label><br/>
<input type="radio" name="upAndDown_2" id="upAndDown_23" value="NA" checked="checked"/><label for="upAndDown_22">NA</label>

It's indeed the surrounding <label> tag that causes the Firefox issue (although it is valid html).
This should do the trick:

<input type="radio" name="upAndDown_2" id="upAndDown_21" value="Y"/><label for="upAndDown_21">Y</label><br/>
<input type="radio" name="upAndDown_2" id="upAndDown_22" value="N"/><label for="upAndDown_22">N</label><br/>
<input type="radio" name="upAndDown_2" id="upAndDown_23" value="NA" checked="checked"/><label for="upAndDown_22">NA</label>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文