The onwheel แอตทริบิวต์ทริกเกอร์เมื่อล้อเลื่อนของเมาส์เลื่อนขึ้นหรือลงเหนือองค์ประกอบ คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน onwheel แอตทริบิวต์ −
ตัวอย่าง
<!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>