Jump to content

How to Check if the MouseCursor is Within the Area of a Web Element?


Recommended Posts

Hello

Let's say I have a webpage, with some elements in it, like Image, Table, etc.

I want to check if the user's mouse is Inside the Table's area for example,

what is the simplest way to check it?

Thank you

Link to comment
Share on other sites

; 1
#include <IE.au3>

Dim $oIE = _IE_Example('table')
Dim $JScript

$JScript = 'alert("Entering table");'
_IEHeadInsertEventScript($oIE, 'tableOne', 'onmouseenter', $JScript)

$JScript = 'alert("Leaving table");'
_IEHeadInsertEventScript($oIE, 'tableOne', 'onmouseleave', $JScript)

; 2
#include <IE.au3>

Dim $oIE = _IE_Example('table')
Dim $oTable = _IEGetObjByName($oIE, 'tableOne')

ObjEvent($oTable, 'Table_')

While _IEPropertyGet($oIE, 'visible')
    Sleep(100)
WEnd

Exit

Func Table_onmouseenter()
    ConsoleWrite('Entering table' & @LF)
EndFunc

Func Table_onmouseleave()
    ConsoleWrite('Leaving table' & @LF)
EndFunc

Link to comment
Share on other sites

anyone knows if there's a way that the Event Handler will call code inside my AutoIt program rather than a Javascript block?

For example,

If I need the onmouseenter event to change the Value of a variable in my AutoIt code, or to run an AutoIt Block rather than Javascript one..

Thank you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...