HTML open select box with a button click

Here is the simple Javascript code to open select box with a button click.

This javascript code also works for toggling the select box.

<script type="text/javascript">
    function expandSelect(id){
    var select_flag = document.getElementById('select_flag').value;
        if(select_flag==1){
            var select_box = document.getElementById(id);
            select_box.size = 1;
            document.getElementById('select_flag').value = 0;
        }else{
            var select_box = document.getElementById(id);
            select_box.size = select_box.options.length; 
            document.getElementById('select_flag').value = 1;
        }
   }
</script>

<button onclick="expandSelect('select_box')"> Toggle Select Box </button>

<div id="container">
    <select name="select_box" id="select_box" >
        <option value="">Select</option>
        <option value="">option1</option>
        <option value="">option2</option>
        <option value="">option3</option>
        <option value="">option4</option>
        <option value="">option5</option>
        <option value="">option6</option>
    </select>
    <input type="hidden" name="select_flag" id="select_flag" value="0">
</div>