Javascript examples for DOM:Event
The type event property returns the event type.
A String, representing the type of the event
The following code shows how to Return the type of event that was triggered:
<!DOCTYPE html> <html> <body onmousedown="myFunction(event)" onmouseup="myFunction(event)" onkeydown="myFunction(event)" onkeyup="myFunction(event)"> <p>Press any key or click the mouse in this document.</p> <p>Event: <span id="demo"></span></p> <script> function myFunction(event) {//from w w w. ja va 2s . c o m var x = event.type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>