event.type: Here type is a property of event object, it is representing the firing event name. <html> <head> <script type = "textscript"> function whichevent(event) { alert("The firing event name is " +event.type) } </script> </head> <body onmousedown= "whichevent(event)"> </body> </html> Output:
Onkeyup: This event will fire or execut when user is releasing the pressed key from the keyboard.
Eg: for onkeyup event: <html> <head> <script type = "text/javascript"> function whenevent(event) { alert("The firing event name is " +event.type) } </sccript> </head> <body onkeyup= "whichevent(event)"> </body> </html> Output:
Eg: To display the ASCII value:
event.keycode: It is aproperty of event object. keycode is representing the ACII value or unicode value of the pressed key from the keyboard. <html> <head> <script type = "text/javascript"> function unicodevalue(event) { alert("unicode value of pressed key is " +event.keycode) } </script> </head> <body onkeyup= "unicode value(event)"> </body> </html> Output:
Eg: To display x & y coordinate values:
event.clientX: ClientX is a property of event object, it is representing the x chords value.
event.clientY: Here clientY is a property of event object. It is representing the y chords value.
Eg: <html> <head> <script type = "text/javascript"> function display(event) { var x = event.clientX var y = event.clientY alert("X value is " +x ", Y value is " +y) } </script> </head> <body onmousedown= "display(event)"> </body> </html> Output: X value is 101, Y value is 208
getElementById(): It is a method of document object.
Using this method we can access an html element by using html Id.
Eg: For getElementById(): <html> <head> <script type = "text/javascript"> function getelement() { var x = document.getElementById("myheader") alert("The element tag name is " +x.tagname) } </script> </head> <body> <h1 id = "myheader" onclick= "getelement()"> Microsoft Windows <h1> </body> </html> Output: