Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Keygen type Property

  • Last Updated : 05 Oct, 2021

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

Syntax:  

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

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.  

HTML




<!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:

  • Google Chrome
  • Internet Explorer Not supported
  • Opera
  • Firefox
  • Apple Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!