HTML DOM Form name property
Definition and Usage
name property can be set or return the name attribute value form form.
name attribute specifies the name of the form.
grammar
formObject.name=formname
Browser Support
All major browsers support attribute name
Examples
Examples
Returns the name of the form of the form:
<html>
<body>
<form id="frm1" name="form1">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
</form>
<script>
document.write(document.getElementById("frm1").name);
</script>
</body>
</html>
<body>
<form id="frm1" name="form1">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
</form>
<script>
document.write(document.getElementById("frm1").name);
</script>
</body>
</html>
Examples of the above output:
form1
try it"
Form Object