i believe there object in javascript called event
, see in code wasn't written me in lines this:
event.x + document.body.scrollleft;
i having trouble finding more out information, furthermore, object comes undefined in firefox. works fine in other browsers. can provide me more information? how access object in firefox?
official w3c reccomendation
clientx
, clienty
official event property handlers looking for. although might want consider screenx
, screeny
too.
explanation
event.x
, event.y
, those?
first of all, x
, y
properties not in events. relative on event triggered.
here example:
document.body.onclick = function(){console.log(window.event.x)};
if paste , execute code in browser's console, log x
position of cursor each time click
.
although taking @ example:
document.body.onkeyup = function(){console.log(window.event.x)};
the console log undefined
each , everytime release key keyboard, since onkeyup()
event not hold values x
, y
properties.
Comments
Post a Comment