Sự kiện onmousedown kích hoạt khi nhấn nút chuột.
Ví dụ
Bạn có thể thử chạy mã sau để tìm hiểu cách làm việc với onmousedown sự kiện trong JavaScript -
<html>
<head>
<script>
<!--
function sayHello() {
alert("You clicked here.")
}
//-->
</script>
</head>
<body>
<p onmousedown = "sayHello()">This is demo text. The onmousedown event triggers when a mouse button is pressed</p>
</body>
</html>