ในการตั้งค่าประเภทของประเภทตัวทำเครื่องหมายรายการ ให้ใช้ listStyleType คุณสมบัติ. ประเภทของมาร์กเกอร์อาจเป็นสี่เหลี่ยม วงกลม ไดคัท เป็นต้น
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อตั้งค่าประเภทตัวทำเครื่องหมายรายการด้วย JavaScript -
<!DOCTYPE html>
<html>
<body>
<ul id="myID">
<li>One</li>
<li>Two</li>
</ul>
<button type="button" onclick="displaySquare()">Update list style type (square)</button>
<button type="button" onclick="displayDecimal()">Update list style type (decimal)</button>
<script>
function displaySquare() {
document.getElementById("myID").style.listStyleType = "square";
}
function displayDecimal() {
document.getElementById("myID").style.listStyleType = "decimal";
}
</script>
</body>
</html>