onwheel thuộc tính kích hoạt khi con lăn chuột cuộn lên hoặc xuống trên một phần tử. Bạn có thể thử chạy mã sau để triển khai onwheel thuộc tính -
Ví dụ
<!DOCTYPE html>
<html>
<body>
<h3 id = "myid" onwheel = "mouseWheel()">
This is demo heading.
</h3>
<p>Click above and use mouse wheel to change the heading color.</p>
<script>
function mouseWheel() {
document.getElementById("myid").style.color = "red";
}
</script>
</body>
</html>