Input Month autofocus 属性

Input Month 对象参考手册 Input Month 对象

实例

查看 month 字段是否在页面加载后自动获取焦点:

var x = document.getElementById("myMonth").autofocus;
x输出结果为:
true

尝试一下 »

定义和用法

autofocus 属性用于设置或者返回 month 字段在页面加载后是否自动获取焦点。

该属性反映了 HTML autofocus 属性。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持 autofocus 属性。

注意: Internet Explorer 9 及更早IE版本、 Opera 12 及更早Opera版本浏览器不支持该属性。

注意:Internet Explorer 或 Firefox 浏览器不支持使用 type="month" 属性的 <input> 元素。


语法

返回 autofocus 属性:

monthObject.autofocus

设置 autofocus 属性:

monthObject.autofocus=true|false

属性值

描述
true|false 描述了 month 字段在页面加载后是否获取焦点
  • true - month 字段获取焦点
  • false - 默认。month 字段不获取焦点。

技术细节

返回值:布尔值,如果页面在加载后 month 字段自动获取焦点返回 true,否则返回false。


相关页面

HTML 参考手册: HTML <input> autofocus 属性


Input Month 对象参考手册 Input Month 对象

0 个评论

要回复文章请先登录注册