且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

对(表单属性)感到困惑

更新时间:2022-11-05 13:47:15

否. from属性在HTML5发行之前不存在.您需要查看您的DOCTYPE并做出确定.

No.. The from attribute did not exist prior to HTML5's release. You will need to look at your DOCTYPE and make that determination.

在HTML5之前,您可以使用Javascript并使用Xhr做一些事情来实现这种行为,但是实际上是必需的.

Before HTML5, you could use Javascript and do some stuff with Xhr to accomplish that type of behavior if it was actually needed however.

我找到了您引用的示例 ...

I found the example you cited...

Last name: <input type="text" name="lname" form="form1">

这是HTML5表单规范中的描述: https://www.w3.org/TR/html5/sec-forms.html#element-attrdef-formelements-form

Here is the description in HTML5 Form Specs: https://www.w3.org/TR/html5/sec-forms.html#element-attrdef-formelements-form

此功能使作者可以解决缺少以下方面的支持 嵌套的表单元素.

This feature allows authors to work around the lack of support for nested form elements.

如果可重新关联的表单关联元素具有表单属性 指定,那么该属性的值必须是表单的ID 元素所有者文档中的元素.

If a reassociateable form-associated element has a form attribute specified, then that attribute’s value must be the ID of a form element in the element’s owner Document.

在RFC中还有其他一些注释.建议在那里看看.

Quite a few other comments in the RFC. Recommend taking a look there.

好文章: https://www.impressivewebs.com/html5-form-attribute /

已更新 经过更多考虑之后,看不到任何暗示表单属性可以指定多个表单的内容.支持W3C规范的最简洁的文本为:表单-将控件与 a 表单元素相关联" .

Updated after more consideration not seeing anything which suggests a form attribute can specify more than one form. Most concise text from W3C spec to support that would be: "form - Associates the control with a form element".