Mouse Capture Problem

Hi,
As there a compatibile problem in IE and Netscape, in certain place I have to overcome that please help me out in that.

I have to display a date control on click of a image, that too very near to the image. It possible for me to capture the event and display the calendar near to the image in IE, but netscape is behaving very differently,
please help me out how to capture the events in netscape.

I have to get the x axis and y axis of the mouseclick and the display the calendar in that position.

waiting for the reply.
bfn
aga
LVL 1
AgatheeswaranAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AmericanDogmaCommented:
I can give you a complete calandar scipt with the functionality you describe above. Let me know and I will give you the details.

Didnt want to paste all the code if you didnt want it
0
marc-pmCommented:
Not sure if it helps but :

* Capturing MouseClick :
    var mmX=0;
    var mmY=0;
    function ReadMouseMove(e)
    {
      if(document.all){mmX=event.x; mmY=event.y;}
      else{mmX=e.pageX; mmY=e.pageY;}
    }
    if(!document.all) //Only If Netscape
    {document.captureEvents(Event.MOUSEMOVE);}
    document.onmousemove=ReadMouseMove;

* Mouse Coordinates
    Mouse location is relative to window in IE and
    relative to document in NC

* If you want to place the element next to the image then you could use the image as placeholder - and locate the element according to the image location (image x and y coordinates can be asked if image has "Name" property defined)
0
AgatheeswaranAuthor Commented:
Hi,
Very happy for the quick response,
hi marc-pm : already I got that code but it works all over the document.

My requirement is that, On click of either an Img, Anchor, or a Button, I should get the position of the clicked area.
By using that position its quite easy for me to display the calendar at that position. Again I have to manipulate the screen width and height, so that it will not go beyond the screen.

I hope u would have understand.

thanks
aga
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

marc-pmCommented:
Not good in understanding - sry :)

Witch location are you after then ? Location of the mouse click or location of the object that was clicked ?

Mouse-click capturing works all over the page ofcourse but it only updates 2 global variables to contain x and y coordinates of the last click - just before the "onClick" event of the current object is fired.

So - in case of Anchor you place your code activation into onClick event and get last click position from the global variables that where just updated :) (With IMAGE however is small difference since IT DOES NOT HAVE "onClick" event in every browser - so just place it into Anchor element and use this anchor onClick event)

I had to write similar code myself - one that shows layer in specified place and also keeps the layer in visible area of the browser - actually I had to scroll the page programmatically because the layer had to be close to mouse click AND static object as well :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AgatheeswaranAuthor Commented:
Hi,
I need to pop-up a calendar on a page, when the user clicked on a button, that too very near to the button.

There are two buttons like that, one is on the top and other is on the bottom, so click of top button, pop-up a calendar near to that, and click of the bottom button, pop-up the calendar near to the bottom button.

But the positioning of the buttom may differ, depending on the page contents. For anchor links and images its works fine, but for buttom, feeling bit difficult to get the position for buttom.

regards,
aga
0
COBOLdinosaurCommented:
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
COBOLdinosaurCommented:
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
points to marc-pm

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.