
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
What is the role of pageX Mouse Event in JavaScript?
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.
Example
You can try to run the following code to learn how to implement pageX Mouse event in JavaScript.
<!DOCTYPE html> <html> <body> <p onclick = "coordsFunc(event)"> Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer. </p> <script> 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); } </script> </body> </html>
- Related Articles
- What is the role of altKey Mouse Event in JavaScript?
- What is the role of clientX 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 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?
- Trigger an event IMMEDIATELY on mouse click, not after I let go of the mouse - JavaScript?
- How to disable mouse event on certain elements using JavaScript?
- What is the role of parseFloat() method in JavaScript?
- What is the role of parseInt() method in JavaScript?

Advertisements