Mouse Capture Problem

Posted on 2003-02-18
Medium Priority
Last Modified: 2010-04-06
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.
Question by:Agatheeswaran
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1

Expert Comment

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

Expert Comment

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

* 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)

Author Comment

ID: 7991849
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.

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.


Accepted Solution

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 :)

Author Comment

ID: 8005926
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.

LVL 53

Expert Comment

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.

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.

If the user does not know how to close the question, the options are here:


LVL 53

Expert Comment

ID: 9306082
It is time to clean this abandoned question up.

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

points to marc-pm


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



Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

801 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