set select box size attribute - Javascript DOM

Javascript examples for DOM:Element setAttribute

Description

set select box size attribute

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//  w  w  w . j a v  a 2s .c o m
var o_select = document.getElementById("mySelect");
o_select.size = "10";
    }

      </script> 
   </head> 
   <body> 
      <select class="styled" id="mySelect"> 
         <option>This is an option</option> 
         <option>This is another option</option> 
      </select>  
   </body>
</html>

Related Tutorials