This commit is contained in:
Karan 2021-11-25 19:55:30 +05:30 committed by GitHub
parent 04f761b6f7
commit a627db0cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,37 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Complete JavaScript Course</title>
<style>
.holder {
display: inline-block;
width: 300px;
height: 300px;
border: 1px solid black;
padding: 10px;
}
.active {
background-color: red;
}
</style>
</head>
<body> 
  <div class="holder">   
    <div id="output"></div>   
</div>   
<script>     
const ele = document.querySelector('.holder');
ele.addEventListener('mouseover', () => { this.classList.add('active'); })
ele.addEventListener('mouseout', () => { this.classList.remove('active'); })
ele.addEventListener('mousemove', coordin);
function coordin() {
let html = "X:" + event.clientX + " | Y:" + event.clientY;
document.getElementById('output').innerHTML = html;
}
</script>
</body>
</html>