크기 속성 선택
예시
드롭다운 목록에서 표시되는 옵션의 수를 변경합니다.
document.getElementById("mySelect").size = "4";
정의 및 사용
크기 속성은 드롭다운 목록의 크기 속성 값을 설정하거나 반환합니다.
크기 속성은 드롭다운 목록에 표시되는 옵션의 수를 지정합니다.
참고: Chrome 및 Safari에서 size 속성은 size="2" 및 size="3"에 대해 예상대로 작동하지 않을 수 있습니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
size | Yes | Yes | Yes | Yes | Yes |
통사론
크기 속성을 반환합니다.
selectObject.size
크기 속성을 설정합니다.
selectObject.size = number
속성 값
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. |
기술적 세부 사항
반환 값: | 드롭다운 목록에 표시되는 옵션의 수를 나타내는 숫자 |
---|
더 많은 예
예시
드롭다운 목록에 표시되는 옵션의 수를 반환합니다.
var x = document.getElementById("mySelect").size;
관련 페이지
HTML 참조: HTML <select> 크기 속성
❮ 개체 선택