<html>
<body>
<select id="mySelect" size="1">
<option>Cat</option>
<option>Dog</option>
<option>Horse</option>
<option>Elephant</option>
<option>Mouse</option>
<option>Fish</option>
<option>Cow</option>
</select>
<p>Click the button to change the number of visible options in the dropdown list.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("mySelect").size = "4";
}
</script>
</body>
</html>