Open In App

HTML DOM Keygen type Property

The HTML DOM Keygen type property is used to return the type of form element containing the Keygen field. This property will always return “keygen”.

Syntax:  



Return the keygen type property.

 keygenObject.type

Return Values: It returns a string value that represents the type of form element’s keygen field. 



Example: Below program illustrates the use of keygen type property.  




<!DOCTYPE html>
<html>
 
<head>
    <style>
        h2 {
            color: green;
        }
 
        body {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h2>GeeksforGeeks</h2>
    <p><b>HTML DOM Keygen type Property</b></p>
    <br>
     
    <form id="formID">
        Username:
        <input type="text" name="uname">
        <br><br> Encryption:
        <keygen id="keyid" form="formID"
            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("keyid").type;
            document.getElementById("test").innerHTML = d;
        }
    </script>
</body>
 
</html>

Output:

 Supported Browsers:


Article Tags :