<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
</head>
<body>
<img src="./img/happy.png" alt="obrazek" id="img">
<script>
let img = document.getElementById("img")
img.addEventListener("click",(e) => {
if (e.clientX >= 25 && e.clientX <= 300){
if (e.clientY >= 300 && e.clientY <= 600) {
img.src = "./img/sad.png"
}
}
console.log(e.clientX)
console.log(e.clientY)
})
img.addEventListener("mouseleave",(e) => {
img.src = "./img/happy.png"
})
</script>
</body>
</html>