Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Select type

The type property returns the type of the select box. This is either select-multiple, if the multiple attribute is set in the tag, or select-one if it is not. <html>     <head>     <script language="JavaScript1.1">     <!--     function getType(){       alert("The name of this text box is " + document.myForm.elements[0].type);     }     -->     </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 Type" name="myButton" onClick='getType()'>     </form>     </body>     </html>