The onmouseover แอตทริบิวต์ทริกเกอร์เมื่อตัวชี้เมาส์เลื่อนเหนือองค์ประกอบใน HTML
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน onmouseover แอตทริบิวต์ −
<!DOCTYPE html>
<html>
<body>
<h3 id = "myid" onmouseover = "display()">
This is demo heading.
</h3>
<p>Keep the mouse cursor on the heading to change the color.</p>
<script>
function display() {
document.getElementById("myid").style.color = "red";
}
</script>
</body>
</html>