<html>
<body>
<form id="myForm">
First name: <input type="text" name="fname">
<input type="submit" id="mySubmit">
</form>
<p>Click the "Try it" button to display the id of the form the Submit button belongs to.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("mySubmit").form.id;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_submit_form by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 14:47:22 GMT -->
</html>