Pilih Properti fokus otomatis
Contoh
Cari tahu apakah daftar tarik-turun secara otomatis mendapatkan fokus saat memuat halaman:
var x = document.getElementById("mySelect").autofocus;
Definisi dan Penggunaan
Properti fokus otomatis mengatur atau mengembalikan apakah daftar drop-down harus secara otomatis mendapatkan fokus saat halaman dimuat, atau tidak.
Properti ini mencerminkan atribut autofokus HTML.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
autofocus | Yes | 10.0 | Yes | Yes | Yes |
Sintaksis
Kembalikan properti fokus otomatis:
selectObject.autofocus
Setel properti fokus otomatis:
selectObject.autofocus = true|false
Nilai properti
Value | Description |
---|---|
true|false |
Specifies whether a
drop-down list should get focus when the page loads, or not
|
Detail Teknis
Nilai Kembali: | Sebuah Boolean, mengembalikan true jika daftar drop-down secara otomatis mendapatkan fokus saat halaman dimuat, jika tidak maka akan mengembalikan false |
---|
Halaman Terkait
Referensi HTML: HTML <select> atribut autofokus
Pilih Objek