When a mouse event is triggered, the pageY mouse event property is used to get the vertical coordinate of the mouse pointer. The coordinate is relative to the screen.ExampleYou can try to run the following code to learn how to implement pageY Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer. function coordsFunc(event) { var x_coord = event.pageX; var y_coord = event.pageY; var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord; document.write(xycoords); }
When a mouse event is triggered, the pageX mouse event property is used to get the horizontal coordinate of the mouse pointer. The coordinate is relative to the screen.ExampleYou can try to run the following code to learn how to implement pageX Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer. function coordsFunc(event) { var x_coord = event.pageX; var y_coord = event.pageY; var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord; document.write(xycoords); }
The ctrlkey mouse event property is used to show whether the CTRL key is pressed or not when the mouse button is clicked.ExampleYou can try to run the following code to learn how to implement ctrlKey Mouse event in JavaScript. Press and hold CTRL key and then click here. function funcCtrlKey(event) { if (event.ctrlKey) { alert("CTRL key: Pressed"); } else { alert("CTRL key: NOT Pressed"); } }
Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert -Infinity Number in JavaScript.ExampleLive Demo Convert -Infinity to Number var myVal = -Infinity; document.write("Number : " + Number(myVal)); OutputConvert -Infinity to Number Number : -Infinity
The shiftkey mouse event property is used to show whether SHIFT key is pressed or not when mouse button is clicked.ExampleYou can try to run the following code to learn how to implement shiftKey Mouse event in JavaScript. Press and hold SHIFT key and then click here. function funcShiftKey(event) { if (event.shiftKey) { alert("SHIFT key: Pressed"); } else { alert("SHIFT key: NOT Pressed"); } }
When a mouse event is triggered, the clientY mouse event property is used to get the vertical coordinate of the mouse pointer. This is according to the current window.ExampleYou can try to run the following code to learn how to implement clientY Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates (according to current window) of the mouse pointer. function coordsFunc(event) { var x_coord = event.clientX; var y_coord = event.clientY; var xycoords = "X coords= " + x_coord + ", Y coords = " + y_coord; document.write(xycoords); }
When a mouse event is triggered, the clientX mouse event property is used to get the horizontal coordinate of the mouse pointer. This is according to current window.ExampleYou can try to run the following code to learn how to implement clientX Mouse event in JavaScript. Click here to get the x (horizontal) and y (vertical) coordinates (according to current window) of the mouse pointer. function coordsFunc(event) { var x_coord = event.clientX; var y_coord = event.clientY; var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord; document.write(xycoords); }
Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert [ ] to Number in JavaScript.ExampleLive Demo Convert [] to Number var myVal = []; document.write("Number: " + Number(myVal));
The onpaste event occurs when you paste content in the element.ExampleYou can try to run the following code to learn how to work with onpaste event in JavaScript. function pasteFunction() { document.write("Text pasted successfully!"); }
The altkey mouse event property is used to show whether SHIFT key is pressed or not when mouse button is clicked.ExampleYou can try to run the following code to learn how to implement altKey Mouse event in JavaScript. Press and hold ALT key and then click here. function funcAltKey(event) { if (event.altKey) { alert("ALT key: Pressed"); } else { alert("ALT key: NOT Pressed"); } }
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP