Page 1 of 1

Getting coordinates of mouse click

Posted: Thu Jun 11, 2009 4:47 am
by rasimmer
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.

Getting coordinates of mouse click

Posted: Thu Jun 11, 2009 5:28 am
by jvierra
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