

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the role of clientX Mouse Event in JavaScript?
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.
Example
You can try to run the following code to learn how to implement clientX Mouse event in JavaScript.
<!DOCTYPE html> <html> <body> <p onclick = "coordsFunc(event)"> Click here to get the x (horizontal) and y (vertical) coordinates (according to current window) of the mouse pointer. </p> <script> 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); } </script> </body> </html>
- Related Questions & Answers
- What is the role of altKey Mouse Event in JavaScript?
- What is the role of clientY Mouse Event in JavaScript?
- What is the role of ctrlKey Mouse Event in JavaScript?
- What is the role of pageX Mouse Event in JavaScript?
- What is the role of pageY Mouse Event in JavaScript?
- What is the role of screenX Mouse Event in JavaScript?
- What is the role of screenY Mouse Event in JavaScript?
- What is the role of shiftKey Mouse Event in JavaScript?
- What is the role of Keyboard Event shiftKey Property in JavaScript?
- What is the role of Keyboard Event ctrlKey Property in JavaScript?
- What is the role of Keyboard Event altKey Property in JavaScript?
- What is the role of clearTimeout() function in JavaScript?
- What is the role of throw statement in JavaScript?
- What is the role of filter() method in JavaScript?
- What is the role of Navigator object in JavaScript?
Advertisements