D
Dave Hammond
I have an html element (a link) with an onclick handler which opens a
popup window, and would like to position that window at the coordinates
where the element appears on the page. I have installed a
document.onclick event handler which saves the eventX and eventY
values, then use those values to set the window top/left coordinates.
The problem is that the eventX and eventY values always seem to be the
previous coordinates, not the current ones. In other words, the first
time that I click the element, no coordinates have been set. The next
time I click the element, the coordinates from the first click have
been saved. Because there are multiple clickable elements on the page,
the effect is that the popup window is always opening at the previous
cursor position rather than the current position.
It seems like my document.onclick event handler is being called after
the onClick handler defined for the particular HTML element.
Can anyone provide info on how I can detect the current cursor position
before the element-specific onClick handler executes?
Thanks!
-Dave H.
popup window, and would like to position that window at the coordinates
where the element appears on the page. I have installed a
document.onclick event handler which saves the eventX and eventY
values, then use those values to set the window top/left coordinates.
The problem is that the eventX and eventY values always seem to be the
previous coordinates, not the current ones. In other words, the first
time that I click the element, no coordinates have been set. The next
time I click the element, the coordinates from the first click have
been saved. Because there are multiple clickable elements on the page,
the effect is that the popup window is always opening at the previous
cursor position rather than the current position.
It seems like my document.onclick event handler is being called after
the onClick handler defined for the particular HTML element.
Can anyone provide info on how I can detect the current cursor position
before the element-specific onClick handler executes?
Thanks!
-Dave H.