Project 3
This commit is contained in:
parent
ec4ae6e57d
commit
3372587b61
34
Chapter 11/Project 3
Normal file
34
Chapter 11/Project 3
Normal file
@ -0,0 +1,34 @@
|
||||
<!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", (e) => { e.target.classList.add("active"); })
|
||||
ele.addEventListener("mouseout", (e) => { e.target.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>
|
||||
Loading…
x
Reference in New Issue
Block a user