Latest web development tutorials

HTML DOM Button name attribute

Button Object Reference Button Objects

Definition and Usage

name property sets or returns the name attribute value of the button.

developed a name attribute name of the button, commonly used in the form submission data cited in the background of dynamic languages, or for reference in Javascript elements. / P>

grammar

buttonObject.name=name


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support name attribute.


Examples

Examples

Returns the name attribute value of the button:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>

<button id="button1" name="button1">点我!</button>
<p>按钮的名称:
<script>
document.write(document.getElementById("button1").name);
</script></p>

</body>
</html>

try it"


Button Object Reference Button Objects