Hello Friends,
Today i am writing How to get mouse position in ASP.NET using JavaScript. If you have need to find your mouse pointer location this code and articles will be helpful for you
EXAMPLE:
Today i am writing How to get mouse position in ASP.NET using JavaScript. If you have need to find your mouse pointer location this code and articles will be helpful for you
EXAMPLE:
<html> <body> <script language="JavaScript"> document.onmousemove = getCoordinate; var mosX = 0; var mosY = 0; function getCoordinate(e) { mosX = event.clientX + document.body.scrollLeft; //clientX Property Sets or retrieves the x-coordinate of the mouse //pointer's position relative to the client area of the window, //excluding window decorations and scroll bars //scrollLeft Property Sets or retrieves the distance between the //left edge of the object and the leftmost portion of the content //currently visible in the window. mosY = event.clientY + document.body.scrollTop; //clientY Property Sets or retrieves the y-coordinate of the mouse //pointer's position relative to the client area of the window, //excluding window decorations and scroll bars. //scrollTop Property Sets or retrieves the distance between the top //of the object and the topmost portion of the content currently //visible in the window. document.title = "(X Co-Ordinate » " + mosX + ") ( " + "Y Co-ordinate » " + mosY + ")"; document.getElementById('dx').innerHTML = "Mouse X ==» " + mosX + "<br>" + "Mouse Y ==» " + mosY; return true } </script> <div id="dX"> </div> </body> </html>
Simple copy and paste above code in your page and see magic, you can edit javascript according you also.







0 comments:
Post a Comment