Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Textarea name

The name property returns the name of the text area. This property is often accessed via the elements array of a Form object and used to return the name of the text area. <html>     <head>     <script language="JavaScript">     <!--     function getName(){       alert("The name of this text area is " + document.myForm.elements[0].name);     }     -->     </script>     </head>     <body>     <form name="myForm">       <textarea name="myTextArea" rows=6 cols=50>       Here is some text in my text area.       </textarea>       <input type=BUTTON value="Get Name" name="myButton" onClick='getName()'>     </form>     </body>     </html>