ในการตั้งค่าประเภทของเคอร์เซอร์ ให้ใช้ เคอร์เซอร์ คุณสมบัติในจาวาสคริปต์ ช่วยให้คุณเปลี่ยนเคอร์เซอร์เมื่อคลิกปุ่ม
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อกำหนดประเภทของเคอร์เซอร์ที่จะแสดงสำหรับตัวชี้เมาส์ด้วย JavaScript -
<!DOCTYPE html>
<html>
<body>
<h1 id="myID">Heading 1</h1>
<p>Check the heading before and after mouse hover.</p>
<button type="button" onclick="display()">Click to change the cursor</button>
<script>
function display() {
document.getElementById("myID").style.cursor = "pointer";
}
</script>
</body>
</html>