HTML DOM listStyle 属性
定义和用法
listStyle 属性在一个声明中设置所有列表属性。
语法:
- Object.style.listStyle=listStyleType listStylePosition listStyleImage
Possible Values
值 | 描述 | 值 |
---|---|---|
listStyleType | 设置列表项标志的类型。 注释:并非右列中的所有值在所有浏览器中都有效。 | - none - disc - circle - square - decimal - decimal-leading-zero - lower-roman - upper-roman - lower-alpha - upper-alpha - lower-greek - lower-latin - upper-latin - hebrew - armenian - georgian - cjk-ideographic - hiragana - katakana - hiragana-iroha - katakana-iroha |
listStylePosition | 对列表项标志进行定位。 | - outside - inside |
listStyleImage | 把图像设置为列表项标志。 | - none - url(url) |
实例
本例改变列表的类型:
- <html>
- <head>
- <script type="text/javascript">
- function changeList()
- {
document.getElementById("ul1").style.listStyle="decimal inside";
- }
- </script>
- </head>
- <body>
- <ul id="ul1">
- <li>Coffee</li>
- <li>Tea</li>
- <li>Water</li>
- <li>Soda</li>
- </ul>
- <input type="button" onclick="changeList()"
- value="Change list style" />
- </body>
- </html>