Javascript examples for DOM Event:onclick
Handle html body double click event with ondblclick and get clicked element
<!doctype html> <html> <head> <meta charset="utf-8"> <title>ondblclick event example</title> <script> function initElement() {/*w w w.j a v a2 s. c o m*/ var body = document.getElementById("bdy"); body.ondblclick = showAlert; } function showAlert(e){ console.log(e.target.id); } window.onload = initElement; </script> </head> <body id="bdy"> <div id="id1"> dasd </div> <div id="id2"> dasda </div> </body> </html>