Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Text type

The type property returns the type of the text box. This always returns text. <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">       <input type=TEXT value="First Box" name="myText">       <input type=BUTTON value="Get Type" name="myButton" onClick='getType()'>     </form>     </body>     </html>