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 单选按钮?

        Should One HTML Radio Button In a Radio Group Always Be Checked?(是否应该始终选中单选组中的一个 HTML 单选按钮?)

        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 单选按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  keeping radio buttons checked after form submit(表单提交后保持选中单选按钮)
                  Styling radio button - not work in IE and Firefox(样式单选按钮 - 在 IE 和 Firefox 中不起作用)
                  Bootstrap radio button quot;checkedquot; flag(Bootstrap 单选按钮“已选中旗帜)
                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)
                  1. <tfoot id='sIBoI'></tfoot>

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

                        • <legend id='sIBoI'><style id='sIBoI'><dir id='sIBoI'><q id='sIBoI'></q></dir></style></legend>

                          • <bdo id='sIBoI'></bdo><ul id='sIBoI'></ul>
                              <tbody id='sIBoI'></tbody>
                            <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>