커서 유형을 설정하려면 커서를 사용하세요. JavaScript의 속성. 버튼 클릭 시 커서를 변경할 수 있습니다.
예시
다음 코드를 실행하여 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>