HTML DOM listStyleType 属性

定义和用法

listStyleType 属性设置列表项标志的类型。

语法:

  1. Object.style.listStyleType=value

可能的值

CSS2 的值:

描述
none 无标记。
disc 默认。标记是实心圆。
circle 标记是空心圆。
square 标记是实心方块。
decimal 标记是数字。
decimal-leading-zero 0开头的数字标记。(01, 02, 03, 等。)
lower-roman 小写罗马数字(i, ii, iii, iv, v, 等。)
upper-roman 大写罗马数字(I, II, III, IV, V, 等。)
lower-alpha 小写英文字母The marker is lower-alpha (a, b, c, d, e, 等。)
upper-alpha 大写英文字母The marker is upper-alpha (A, B, C, D, E, 等。)
lower-greek 小写希腊字母(alpha, beta, gamma, 等。)
lower-latin 小写拉丁字母(a, b, c, d, e, 等。)
upper-latin 大写拉丁字母(A, B, C, D, E, 等。)
hebrew 传统的希伯来编号方式
armenian 传统的亚美尼亚编号方式
georgian 传统的乔治亚编号方式(an, ban, gan, 等。)
cjk-ideographic 简单的表意数字
hiragana 标记是:a, i, u, e, o, ka, ki, 等。(日文片假名)
katakana 标记是:A, I, U, E, O, KA, KI, 等。(日文片假名)
hiragana-iroha 标记是:i, ro, ha, ni, ho, he, to, 等。(日文片假名)
katakana-iroha 标记是:I, RO, HA, NI, HO, HE, TO, 等。(日文片假名)

CSS2.1 的值:

  1. disc | circle | square | decimal | decimal-leading-zero |
  2. lower-roman | upper-roman | lower-greek | lower-latin | upper-latin |
  3. armenian | georgian | none | inherit

实例

本例改变列表项的类型:

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function changeList()
  5. {
  6. document.getElementById("ul1").style.listStyleType="square";
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <ul id="ul1">
  13. <li>Coffee</li>
  14. <li>Tea</li>
  15. <li>Water</li>
  16. <li>Soda</li>
  17. </ul>
  18.  
  19. <input type="button" onclick="changeList()"
  20. value="Change list-item marker type" />
  21.  
  22. </body>
  23. </html>