Button.name : Button : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » Button »

 

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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» Button