html checked属性值,HTML复选框的checked属性的值是多少?

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

我们都知道如何在HTML中构成复选框输入:

我不知道 - 选中复选框的技术上正确的值是多少?我已经看到了这些工作:

答案是无关紧要的?我没有看到答案标记为正确的证据[这里< /

a>来自规范本身:Checkboxes (and radio buttons) are on/off switches that may be toggled by

the user. A switch is “on” when the control element’s checked attribute is

set. When a form is submitted, only “on” checkbox controls can become

successful. Several checkboxes in a form may share the same control name.

Thus, for example, checkboxes allow users to select several values for the

same property. The INPUT element is used to create a checkbox control.

规格作家会说什么是正确的答案?请提供以证据为基础的答案。

严格地说,你应该把一些有意义的东西 -

根据规范这里,最正确的版本是:

对于HTML,您也可以使用[空属性语法

但实际上,大多数浏览器只支持引号之间的任何值。所有以下内容将被检查:

只有以下内容才会被取消选中:

HTML5规范 :The disabled content attribute is a boolean attribute.The presence of a boolean attribute on an element represents the true value,

and the absence of the attribute represents the false value.

>If the attribute is present, its value must either be the empty string or a

value that is an ASCII case-insensitive match for the attribute’s canonical

name, with no leading or trailing whitespace.

结论:

以下是 有效的,等同的和真实的 :

以下是 无效 :

缺少该属性是 false 的唯一有效语法:

建议

由于&lt; input checked&gt;是无效的XHTML(但是有效的HTML)和其他的选择是如果你关心写有效的XHTML,使用checked =“checked”可读性较差。否则,只需使用&lt;输入检查&gt; `,因为它更短。

未经作者同意,本文严禁转载,违者必究!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值