Select.length : Select : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » Select »

 

Select.length







The length property of an instance of a Select object returns the number of items in the select box.












<html>
    <head>
    <script language="JavaScript">
    <!--
    function getName(){
      alert("The length of this select box is " + document.myForm.mySelect.length);
    }
    -->
    </script>
    </head>
    <body>
    <form name="myForm">
      <select name="mySelect">
        <option value=A>AA</option>
        <option value=B>BB</option>
        <option value=C>CC</option>
        <option value=D>DD</option>
      </select>
      <input type=BUTTON value="Get Name" name="myButton" onClick='getName()'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» Select