Javascript examples for DOM Event:onclick
Get event clicked pageX and pageY
<html> <head></head> <body> <script type="text/javascript"> counter = 1;//w w w . j a v a2 s.c om document.onclick = function(e) { var button = document.createElement('button'); button.style.position = 'fixed'; button.style.left = e.pageX + 'px'; button.style.top = e.pageY + 'px'; button.innerHTML = counter; counter++; document.body.appendChild(button); setTimeout(function() { document.body.removeChild(button); }, 1000); }; </script> </body> </html>