Input Datetime form 属性

定义和用法

form 属性返回对包含日期时间字段的表单的引用。

此属性在成功时返回表单对象。

注释:此属性是只读的。

实例

返回包含 <input type="datetime"> 元素的表单的 id:

var x = document.getElementById("myDatetime").form.id;

亲自试一试

语法

datetimeObject.form

Technical details

Return value:

Reference to the form element containing the date and time fields.

If the date control is not in the form, it returns null.

Browser support

The numbers in the table indicate the first browser version to fully support this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="datetime"> element does not display any date and time field/calendar in any mainstream browser except Safari.