HTML DOM Keygen form Property
The Keygen form property in HTML DOM is used to return the reference of the form containing the keygen element. It is a read-only property and returns the form object on success.
Syntax:
keygenObject.form
Return Value: It returns a reference to the form element containing the button. It returns NULL if the keygen is not in the form.
Example: This example shows the working of the Keygen form property.
HTML
<!DOCTYPE html><html> <head> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style></head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM Keygen form Property</h2> <br> <form id="myGeeks"> Username: <input type="text" name="uname"> <br><br> Encryption: <keygen id="Geeks" form="myGeeks" name="secure" autofocus> <input type="submit"> </form> <button onclick="My_form()"> Return </button> <p id="test"></p> <script> function My_form() { var d = document.getElementById("Geeks").form.id; document.getElementById("test").innerHTML = d; } </script></body> </html> |
Output:

Supported Browsers:
- Google Chrome
- Opera
- Firefox
- Apple Safari


