Pilih ukuran Properti
Contoh
Ubah jumlah opsi yang terlihat dalam daftar drop-down:
document.getElementById("mySelect").size = "4";
Definisi dan Penggunaan
Properti size menetapkan atau mengembalikan nilai atribut size dari daftar drop-down.
Atribut size menentukan jumlah opsi yang terlihat dalam daftar drop-down.
Catatan: Di Chrome dan Safari, atribut size mungkin tidak berfungsi seperti yang diharapkan untuk size="2" dan size="3".
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
size | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Kembalikan properti ukuran:
selectObject.size
Setel properti ukuran:
selectObject.size = number
Nilai properti
Value | Description |
---|---|
number | Specifies the number of visible options in a drop-down list. If the value is greater than 1, but lower than the total number of options in the list, the browser will add a scroll bar to indicate that there are more options to view. |
Detail Teknis
Nilai Kembali: | Angka, mewakili jumlah opsi yang terlihat dalam daftar tarik-turun |
---|
Lebih Banyak Contoh
Contoh
Kembalikan jumlah opsi yang terlihat dalam daftar drop-down:
var x = document.getElementById("mySelect").size;
Halaman Terkait
Referensi HTML: HTML <select> atribut ukuran
Pilih Objek