Hello,
I have followed w3schools to create an element such that when I hover the mouse over this element, it starts giving me the coordinates of the mouse pointer. When the mouse is moved out of this element, the coordinate information is no longer displayed.
The code that I have written is s follows
<html>
<head>
<script>
function myFunction(e) {
var x=e.clientX;
var y=e.clientY;
var coor="Coordinates: ("+x+" , "+y+")";
document.getElementById("demo").innerHTML=coor;
}
function clearCoor() {
document.getElementById("demo").innerHTML="";
}
</script>
<style type="text/css">
div {
width:100px;
height:100px;
border:1px solid black;
}
</style>
</head>
<body>
<div onmousemove="myFunction(event)" onmouseout="clearCoor()"></div>
<p id="demo"></p>
</body>
</html>
In the above code, I am not able to understand the event parameter in the following line
<div onmousemove="myFunction(event)" onmouseout="clearCoor()"></div>
Is this an inbuilt keyword etc. In what context do we use and in what we don’t?