Input Week autofocus 屬性

Input Week 對象參考手冊 Input Week 對象

實例

查看 week 字段是否在頁面加載後自動獲取焦點:

var x = document.getElementById("myWeek").autofocus;
x輸出結果為:
true


定義和用法

autofocus 屬性用於設置或者返回 week 字段在頁面加載後是否自動獲取焦點。

該屬性反映了 HTML autofocus 屬性。


流覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流流覽器都支持 autofocus 屬性

注意: Internet Explorer 9 及更早 IE 版本或者 Opera 12 或更早 Opera 版本流覽器不支持 autofocus 屬性。

注意: Internet Explorer 或 Firefox 流覽器不支持 <input type="week"> 元素。


語法

返回 autofocus 屬性:

weekObject.autofocus

設置 autofocus 屬性:

weekObject.autofocus=true|false

屬性值

描述
true|false 描述了 week 字段在頁面加載後是否獲取焦點
  • true - week 字段獲取焦點
  • false - 默認。week 字段不獲取焦點

技術細節

返回值: 布爾值,如果頁面在加載後 week 字段自動獲取焦點返回 true,否則返回false。


相關頁面

HTML 參考手冊: HTML <input> autofocus 屬性


Input Week 對象參考手冊 Input Week 對象