Input Date name 属性
定义和用法
name
属性设置或返回日期字段的 name 属性的值。
HTML name 属性用于在表单数据提交到服务器后识别表单数据,或在客户端使用 JavaScript 引用表单数据。
注释:只有拥有 name 属性的表单元素才会在提交表单时传递它们的值。
另请参阅:
HTML 参考手册:HTML <input> name attribute
实例
例子 1
获取日期字段的名称:
var x = document.getElementById("myDate").name;
例子 2
更改日期字段的名称:
document.getElementById("myDate").name = "newDateName";
语法
返回 name 属性:
inputdateObject.name
设置 name 属性:
inputdateObject.name = name
属性值
Value | Description |
---|---|
name | Specifies the name of the date field. |
Technical details
Return value: | A string value representing the name of the date field. |
---|
Browser support
The numbers in the table indicate the first browser version that fully supports this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |
Note:The <input type="date"> element does not display any date field/calendar in IE11 and earlier versions.