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.
This topic is 14 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
rasimmer
Posts: 182
Last visit: Fri Apr 25, 2014 7:00 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:

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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Getting coordinates of mouse click

Post 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
This topic is 14 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked