<html> <head> <script> var myId = document.getElementById('x'); myId.addEventListener("click", function(e) { alert(e); }, false); </script> </head> <body> <div id="x">Текст</div> </body> </html>