gpt4 book ai didi

html - 是否有提交空选择倍数的标准客户端行为?

转载 作者:可可西里 更新时间:2023-11-01 13:17:20 25 4
gpt4 key购买 nike

http://www.w3.org/TR/html401/interact/forms.html#edef-SELECT

没有指定如果提交的选择倍数为空,客户端应该如何表现。有谁知道这是否有标准?

最佳答案

遗憾的是,我没有时间对此进行测试,但我希望以下内容可以帮助您...

如果我没记错的话,页面加载时默认选中第一个元素。因此,创建一个非常简单的 HTML 文件,其中包含一个 form 和一个 select,该文件具有激活的 multiple 属性和一些 options。然后,打开该文件,看看在 Chrome、Firefox、Internet Explorer、Opera 和 Safari 等浏览器中会发生什么。

另一件事是在此处查看 HTML5 对此的说明:http://dev.w3.org/html5/spec/Overview.html#the-select-element .

更新

W3C HTML 4.01 标准规定了这一点(在您提供的链接中向下滚动一点):

17.6.1 Pre-selected options

Zero or more choices may be pre-selected for the user. User agents should determine which choices are pre-selected as follows:

If no OPTION element has the selected attribute set, user agent behavior for choosing which option is initially selected is undefined. Note. Since existing implementations handle this case differently, the current specification differs from RFC 1866 ([RFC1866] section 8.1.3), which states: The initial state has the first option selected, unless a SELECTED attribute is present on any of the elements. Since user agent behavior differs, authors should ensure that each menu includes a default pre-selected OPTION.

If one OPTION element has the selected attribute set, it should be pre-selected. If the SELECT element has the multiple attribute set and more than one OPTION element has the selected attribute set, they should all be pre-selected. It is considered an error if more than one OPTION element has the selected attribute set and the SELECT element does not have the multiple attribute set. User agents may vary in how they handle this error, but should not pre-select more than one choice.

关于html - 是否有提交空选择倍数的标准客户端行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5242944/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com