Open In App

HTML | DOM Ol type Property

The DOM Ol type Property is used to set or return the type attribute in an ordered list. This attribute defines which type(1, A, a, I and i) of order you want in your list numeric, alphabetic or roman numbers.

Syntax:



Property Values:

Return Value: It returns a string value which represents the kind of marker used in the ordered list.



Example-1: HTML Program that illustrate how to set the type Property.




<!DOCTYPE html> 
<html
    <head
        <title>dom ol type Property</title
    </head
    <body
        <h1 style ="color:green;">GeeksforGeeks</h1
        <h2 style="color:green;">DOM ol type Property</h2
        <p>List of all computer Subjects are</p
        <ol id="GFG"
            <li>Data Structures</li
            <li>Operating System</li
            <li>Python programming</li
            <li>DBMS</LI
            <li>Computer Network</li
        </ol
        <button onclick="myGeeks()">Submit</button>
  
        <!-- Script to set the type of list -->
        <script>
          function myGeeks()  {
            var x = document.getElementById("GFG").type = "a";
          }
        </script>
    </body
</html>                                 


Output:
Before clicking on the button :

After clicking on the button :

Example-2 : HTML Program that illustrate how to return the type Property.




<!DOCTYPE html> 
<html
    <head
        <title>Dom ol type Property</title
    </head
    <body
        <h1 style ="color:green;">GeeksforGeeks</h1
        <h2 style="color:green;">DOM ol type Property</h2
        <p>List of all computer Subjects are</p
        <ol id="GFG" type="I"
            <li>Data Structures</li
            <li>Operating System</li
            <li>python programming</li
            <li>DBMS</li
            <li>Computer Network</li
        </ol
        <button onclick="myGeeks()">Submit</button>
        <p id="sudo" style="font-size:25px;color:green;"></p>
  
        <!-- Script to get the type of list -->
        <script>
          function myGeeks()  {
            var x = document.getElementById("GFG").type;
            document.getElementById("sudo").innerHTML = 
                        "The type of Ordered list:" + x;
          }
        </script>
    </body
</html>                                 


Output:

Before clicking on the button:

After clicking on the button:

Supported Browsers: The browser supported by DOM ol type Property are listed below:


Article Tags :