HTMLOListElement:type 属性
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
HTMLOListElement 接口的 type 属性用于显示排序列表标记的类型。
备注:type 可以在 CSS 中使用 list-style-type 属性定义。 list-style-type 属性提供更多的值。
值
表示类型的字符串。
其可能的值列在属性标记类型部分。
示例
>HTML
html
<ol id="order-list">
<li>Fee</li>
<li>Fi</li>
<li>Fo</li>
<li>Fum</li>
</ol>
JavaScript
js
const olElement = document.querySelector("#order-list");
// 如果没有指定类型,则返回空字符串
console.log(olElement.type); // 输出:""
olElement.type = "i"; // 使用罗马数字类型
console.log(olElement.type); // 输出:"i"
结果
规范
| Specification |
|---|
| HTML> # dom-ol-type> |