javascript - What does it mean in parentheses word (EVENT),in html,and why I have to write it down?without that (event) all the code will not work -


html

<div id="cube" onmousemove= cordinate(event)></div> <p id= "text"></p> 

css

#cube{     width: 300px;     height: 300px;     border: 2px solid black; } 

and js

function cordinate(a){      var x = a.clientx;      var y = a.clienty;      var cor = "cordinates: " + x + "  " + y;      document.getelementbyid("text").innerhtml= cor; 

this code mouse-cordinate of div "cube"

in onxxx attribute, event variable contains object information action caused handler triggered. instance, in onmousemove, event object contains mouse coordinates in clientx , clienty properties.

you can read detailed documentation event object here.

this site has more details on how event object passed event handlers, depending on how define them.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -