JavaScript Reference/Javascript Properties/size select
Версия от 18:30, 25 мая 2010; (обсуждение)
"size" Example
<script>
function function1() {
var col = document.all.colors.size;
alert(col+" number of options")
}
</script>
<form method="post" action="">
<select id="colors" size="10">
<option value="white" selected>White</option>
<option value="cyan">Cyan</option>
<option value="ivory">Ivory</option>
<option value="blue">Blue</option>
<option value="red">Red</option>
<option value="lightblue">Lightblue</option>
<option value="beige">Beige</option>
</select>
<input type="button" value="Number of options" onclick="function1();">
</form>
"size" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<select> |
+----------------+--------------------------------------------------------------+
"size" Syntax and Note
Note:
Read and write property.
Sets the number of rows in <select> list element.
Syntax:
document.getElementById("selectID").size = value
document.all.selectID.size = value // IE only