Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Mouse Capture Problem

Posted on 2003-02-18
7
Medium Priority
?
257 Views
Last Modified: 2010-04-06
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
0
Comment
Question by:Agatheeswaran
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 3

Expert Comment

by:AmericanDogma
ID: 7982835
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
 
LVL 1

Expert Comment

by:marc-pm
ID: 7986453
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
 
LVL 1

Author Comment

by:Agatheeswaran
ID: 7991849
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Accepted Solution

by:
marc-pm earned 400 total points
ID: 8002869
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
 
LVL 1

Author Comment

by:Agatheeswaran
ID: 8005926
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9115171
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9306082
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question