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.
User avatar
Posts: 182
Joined: Fri Jan 30, 2009 12:37 am

Getting coordinates of mouse click

Post 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:, 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.

Posts: 14480
Joined: Tue May 22, 2007 9:57 am

Getting coordinates of mouse click

Post by jvierra »

The Event objet contains teh coordinates of the event click.

Code: Select all

<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  
<body onclick="clickme">  
<!-- HTML goes here -->

See the following for many examples: ...