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 the kind of marker to be used in the list items.

Syntax:

  • It is used to return the type property.
    olObject.type
  • It is used to set the type property.
    olObject.type = "1|a|A|i|I"

Property Values:

  • 1: This is the default value. It defines the list items in decimal number.(1, 2, 3, 4 .).
  • a: It defines the list items in alphabetically ordered lowercase letters .(a, b, c, d …)
  • A: It defines the list items in alphabetically ordered uppercase letters.(A, B, C, D ..)
  • i: It defines the list items in lowercase roman number order.(i, ii, iii, iv, v, vi …)
  • I: It defines the list items in uppercase roman number order.(I, II, III, IV, V, VI ..)

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.

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:
Before clicking on the button :

After clicking on the button :

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

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Before clicking on the button:

After clicking on the button:

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.