1. <legend id='asKbz'><style id='asKbz'><dir id='asKbz'><q id='asKbz'></q></dir></style></legend>
      2. <small id='asKbz'></small><noframes id='asKbz'>

      3. <tfoot id='asKbz'></tfoot>
        <i id='asKbz'><tr id='asKbz'><dt id='asKbz'><q id='asKbz'><span id='asKbz'><b id='asKbz'><form id='asKbz'><ins id='asKbz'></ins><ul id='asKbz'></ul><sub id='asKbz'></sub></form><legend id='asKbz'></legend><bdo id='asKbz'><pre id='asKbz'><center id='asKbz'></center></pre></bdo></b><th id='asKbz'></th></span></q></dt></tr></i><div id='asKbz'><tfoot id='asKbz'></tfoot><dl id='asKbz'><fieldset id='asKbz'></fieldset></dl></div>
          <bdo id='asKbz'></bdo><ul id='asKbz'></ul>

        是否应该始终选中单选组中的一个 HTML 单选按钮?

        时间:2023-10-20

        1. <small id='QaQKS'></small><noframes id='QaQKS'>

            <i id='QaQKS'><tr id='QaQKS'><dt id='QaQKS'><q id='QaQKS'><span id='QaQKS'><b id='QaQKS'><form id='QaQKS'><ins id='QaQKS'></ins><ul id='QaQKS'></ul><sub id='QaQKS'></sub></form><legend id='QaQKS'></legend><bdo id='QaQKS'><pre id='QaQKS'><center id='QaQKS'></center></pre></bdo></b><th id='QaQKS'></th></span></q></dt></tr></i><div id='QaQKS'><tfoot id='QaQKS'></tfoot><dl id='QaQKS'><fieldset id='QaQKS'></fieldset></dl></div>

            <tfoot id='QaQKS'></tfoot>
            • <legend id='QaQKS'><style id='QaQKS'><dir id='QaQKS'><q id='QaQKS'></q></dir></style></legend>

                  <tbody id='QaQKS'></tbody>
                  <bdo id='QaQKS'></bdo><ul id='QaQKS'></ul>

                • 本文介绍了是否应该始终选中单选组中的一个 HTML 单选按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否有任何标准(HTML、UI、可访问性等)规定应始终选择给定单选按钮组中的一个单选按钮?

                  Are there any standards (HTML, UI, accessibility, and such like) that stipulate that one of the radio buttons in a given group of radio buttons should be selected at all times?

                  我遇到了一个业务需求,我被要求不选中组中的两个单选按钮,然后让逻辑强制用户在继续之前选择一个.

                  I have encountered a business requirement whereby I have been asked that both radio buttons in a group be left unchecked, and then to have logic forcing the user to select one before they can continue.

                  虽然我知道如何实现这一点,但感觉不对,因此我暗示了这一点,但我一直在寻找更明确地规定这一点的指南,以便我可以将其纳入我们自己的标准.

                  While I know how to achieve this, it felt wrong, and I intimated as such, but was looking for guidelines that stipulate this more explicitly so I can feed this into our own standards.

                  推荐答案

                  是:http://www.w3.org/TR/html401/interact/forms.html#radio

                  始终只选中一组中的一个单选按钮.如果一组单选按钮的任何元素都没有指定已检查",则用户代理必须首先检查该组的第一个单选按钮.

                  At all times, exactly one of the radio buttons in a set is checked. If none of the elements of a set of radio buttons specifies `CHECKED', then the user agent must check the first radio button of the set initially.

                  规范使用术语用户代理"来表示通常称为浏览器".所以规范说如果没有检查,浏览器会先检查.

                  The specification uses the term "user agent" for what is commonly known as "browser". So the specification says that if none is checked, the browser will check the first.

                  更新: 请注意,我尝试过的 4 个浏览器都没有真正做到这一点! 他们不检查第一个并且 没有 收音机是以 =on 形式提供给服务器.一个好的 Web 框架应该进行服务器端检查(无论如何都应该这样做,因为突然或伪造的 POST 可能会导致相同的结果).

                  UPDATE: note that none of the 4 Browsers i tried actually does this! They dont check the first and none of the radios are given as =on to the server. A good web framework should do the serverside-checking (it should do it anyway because an abrupted or forged POST could cause the same).

                  这篇关于是否应该始终选中单选组中的一个 HTML 单选按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:标签下方的中心单选按钮 下一篇:打开页面的单选按钮

                  相关文章

                  1. <tfoot id='sIBoI'></tfoot>

                      <small id='sIBoI'></small><noframes id='sIBoI'>

                    1. <legend id='sIBoI'><style id='sIBoI'><dir id='sIBoI'><q id='sIBoI'></q></dir></style></legend>

                      • <bdo id='sIBoI'></bdo><ul id='sIBoI'></ul>
                      <i id='sIBoI'><tr id='sIBoI'><dt id='sIBoI'><q id='sIBoI'><span id='sIBoI'><b id='sIBoI'><form id='sIBoI'><ins id='sIBoI'></ins><ul id='sIBoI'></ul><sub id='sIBoI'></sub></form><legend id='sIBoI'></legend><bdo id='sIBoI'><pre id='sIBoI'><center id='sIBoI'></center></pre></bdo></b><th id='sIBoI'></th></span></q></dt></tr></i><div id='sIBoI'><tfoot id='sIBoI'></tfoot><dl id='sIBoI'><fieldset id='sIBoI'></fieldset></dl></div>