You are here: Reference > JavaScript > client-side > HTML DOM > properties > type (dir, li, menu, ol, ul)
type property (dir, li, menu, ol, ul)
Specifies or returns the numbering style of a list.
This property is deprecated. Use the listStyleType style property instead.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: type |
Possible values:
String that sets or retrieves the type of the numbering style.
One of the following values:
Indicates numbers. Default for ol elements. This value is not supported for ul elements in Safari and Google Chrome. | |||||||
Indicates lowercase letters. This value is not supported for ul elements in Safari and Google Chrome. | |||||||
Indicates uppercase letters. This value is not supported for ul elements in Safari and Google Chrome. | |||||||
Indicates lowercase Roman numerals. This value is not supported for ul elements in Safari and Google Chrome. | |||||||
Indicates uppercase Roman numerals. This value is not supported for ul elements in Safari and Google Chrome. | |||||||
Indicates a hollow circle. This value is not supported for ol elements in Safari and Google Chrome. | |||||||
Indicates a solid disc. Default for ul elements. This value is not supported for ol elements in Safari and Google Chrome. | |||||||
Indicates a solid square. This value is not supported for ol elements in Safari and Google Chrome. |
Default: 1.
Example HTML code 1:
This example illustrates the use of the type attribute:
|
||||
<ul type="square"> <li>Apple</li> <li>Pear</li> <li>Peach</li> </ul> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
Recommendation:
|
||||
<ul style="list-style-type:square"> <li>Apple</li> <li>Pear</li> <li>Peach</li> </ul> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 3:
This example illustrates the use of the type property:
|
||||
<head> <script type="text/javascript"> function ChangeType (elem) { var list = document.getElementById ("myList"); // Returns the index of the selected option var whichSelected = elem.selectedIndex; // Returns the text of the selected option var listType = elem.options[whichSelected].text; list.type = listType; } </script> </head> <body> <ol id="myList" type="square"> <li>Apple</li> <li>Pear</li> <li>Peach</li> </ol> <select onchange="ChangeType (this);" size="8"> <option />1 <option />a <option />A <option />i <option />I <option />circle <option />disc <option selected="selected" />square </select> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
type (LI, OL, UL) (MSDN)
type (Safari Reference Library)
type (LI) (W3C)
type (OL) (W3C)
type (UL) (W3C)
type (Safari Reference Library)
type (LI) (W3C)
type (OL) (W3C)
type (UL) (W3C)
User Contributed Comments