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 keygen element. 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 >w3wiki</ h1 > < h2 >HTML DOM Keygen form Property</ h2 > < br > < form id = "myBeginner" > Username: < input type = "text" name = "uname" > < br >< br > Encryption: < keygen id = "Beginner" form = "myBeginner" 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("Beginner").form.id; document.getElementById("test").innerHTML = d; } </ script > </ body > </ html > |
Output:
Supported Browsers:
- Google Chrome
- Opera
- Firefox
- Apple Safari