Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Button name

Syntax document.form.button.name The name property provides access to the NAME attribute of the button as specified by the tag. This property is a read-only string. <html>     <script language="JavaScript">     <!--     function displayMessage()     {       var alertString = String("You pressed the button named ");       alertString += document.myForm.myButton.name;       alert(alertString);     }     -->     </script>         <form name="myForm">       <input type="button"              value="Big Button"              name="myButton"              onClick="displayMessage()">     </form>     </html>