Button.name
JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera 3+ Syntax
document.form.button.name
Description
The name property provides access to the NAME attribute of the button as specified by the <input> tag. This property is a read-only string.
Example
In Listing 7.27, a button is created. When the button is clicked, the button's name property is displayed.
Listing 7.27 Accessing a Button's Name with the name Property
<html> <form name="myForm"> <input type="button" value="Big Button" name="myButton" onClick="displayMessage()"> </form> <script language="JavaScript"> <!-- Hide //This function displays an alert box the contains the name of the button. function displayMessage() { //Create a string with name of button var alertString ... |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.