Getting coordinates of mouse click

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
rasimmer
Posts: 182
Joined: Fri Jan 30, 2009 12:37 am

Getting coordinates of mouse click

Post by rasimmer » Thu Jun 11, 2009 4:47 am

I want to create a popup in an HTA based on the position of the mouse click (which would be on the <A> tag for a link) . The .Show popup method allows me to tell it where I want to put the popup:

object.show(iX, iY, iWidth, iHeight [, oElement])

I just want to know how to get the mouse coordinates. I assume it's a Window.Event of some sort I'm capturing? I see lots of JavaScript examples, I was just trying to stick to VBScript though.

User avatar
jvierra
Posts: 13725
Joined: Tue May 22, 2007 9:57 am
Contact:

Getting coordinates of mouse click

Post by jvierra » Thu Jun 11, 2009 5:28 am

The Event objet contains teh coordinates of the event click.

Code: Select all

 <html>
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">  
<title>My HTML Application</title>  
<script language="vbscript">  
    <!-- Insert code, subroutines, and functions here -->  
        Sub clickme()  
           MsgBox "clientX:" & window.event.clientX & vbCrLf & "clientY:" & window.event.clientY  
        End Sub  
    </script>  
</head>  
<body onclick="clickme">  
<!-- HTML goes here -->
</body>  
</html>

See the following for many examples:

http://www.sapien.com/forums/uploads/24 ... ampler.zip

Locked