Latest web development tutorials

HTML DOM Input DatetimeLocal objects

Input DatetimeLocal objects

Input DatetimeLocal object is a new HTML5.

Input DatetimeLocal object representation using type = "datetime-local" in the HTML <input> elements.

Note: Internet Explorer or Firefox browser does not support <input> elements.

Object Access Input DatetimeLocal

You can use getElementById () function to access using type = "datetime-local" <input> element attributes:

var x = document.getElementById("myLocalDate"); 尝试一下

Tip: You can also form elements to access the Input DatetimeLocal collection of objects.

Create Input DatetimeLocal objects

You can use document.createElement () method to create using the type = "datetime-local" property of the <input> element:

var x = document.createElement("INPUT");
x.setAttribute("type", "datetime-local"); 尝试一下

Input DatetimeLocal object properties

属性 描述
autocomplete 设置或返回本地时间字段的 autocomplete 属性值
autofocus 设置或返回本地时间字段在页面加载后是否自动获取焦点
defaultValue 设置或返回本地时间字段默认的值
disabled 设置或返回本地时间字段是否可用
form 返回使用本地时间字段的表单引用
list 返回包含了本地时间字段的 datalist 引用
max 设置或返回本地时间字段的 max 属性值
min 设置或返回本地时间字段的 min 属性值
name 设置或返回本地时间字段的 name 属性值
readOnly 设置或返回本地时间字段是否只读
required 设置或返回本地时间字段在表单中是否为必填字段
step 设置或返回本地时间字段的 step 属性值
type 返回本地时间字段的表单元素类型
value 设置或返回本地时间字段的 value 属性值

Standard properties and events

Input DatetimeLocal objects also supports standard attributes and events .


related articles

HTML Tutorial: HTML Forms

HTML Reference Manual: HTML <the INPUT> tag

HTML Reference Manual: HTML <the INPUT> of the type attribute