Javascript examples for DOM HTML Element:Form
Form name Property - Change the name of a form:
<!DOCTYPE html> <html> <body> <form id="myForm" name="form1" action="#"> First name: <input type="text" name="fname" value="Donald"><br> Last name: <input type="text" name="lname" value="Duck"><br> <input type="submit" value="Submit"> </form>/*from w w w .java 2 s .co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myForm").name = "newName"; document.getElementById("demo").innerHTML = "The name of the form was changed from 'form1' to 'newName'."; } </script> </body> </html>