Thuộc tính kiểu HTML DOM Ol đặt / trả về giá trị của thuộc tính type tương ứng với loại điểm đánh dấu được sử dụng trong danh sách có thứ tự.
Sau đây là cú pháp -
Trả về thuộc tính loại
olObject.type
Đặt loại thành một ký tự
olObject.type = ‘1|a|A|i|I’
Hãy để chúng tôi xem ví dụ về Kiểu Ol tài sản -
Ví dụ
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Ol type</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
ol{
width: 30%;
margin: 0 auto;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>HTML-DOM-Ol-type</legend>
<h3>Students</h3>
<ol id="orderList" type='2'>
<li>Adam</li>
<li>Alex</li>
<li>Bina</li>
<li>Eden</li>
<li>Rajesh</li>
<li>Zampa</li>
</ol>
<input type="button" onclick="changeMarker()" value="Change Marker">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var studentList = document.getElementById("orderList");
function changeMarker() {
studentList.type = 'I';
divDisplay.textContent = 'Marker Changed';
}
</script>
</body>
</html> Đầu ra
Trước khi nhấp vào ‘Thay đổi điểm đánh dấu’ nút -
Sau khi nhấp vào ‘Thay đổi điểm đánh dấu’ nút -