Ol type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Ol

Description

The type property sets or gets the type attribute of an ordered list, which controls the kind of marker to use in the list.

Set the type property with the following Values

Value Description
1 Default. Decimal numbers (1, 2, 3, 4)
a Alphabetically ordered list, lowercase (a, b, c, d)
A Alphabetically ordered list, uppercase (A, B, C, D)
i Roman numbers, lowercase (i, ii, iii, iv)
I Roman numbers, uppercase (I, II, III, IV)

Return Value

A String, representing the kind of marker used in the ordered list

The following code shows how to Set the ordered list to use lowercase alphabetical letters:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ol id="myOl">
  <li>A</li>
  <li>B</li>
  <li>C</li>
</ol>/*from   w  ww.j a va2  s  .  c o  m*/

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
    document.getElementById("myOl").type = "I";
}
</script>

</body>
</html>

Related Tutorials