determining mouse position - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

determining mouse position

mac_doggiemac_doggie Posts: 488Member
I want to create a popup window on the position of the mouse. I want to use this for a popup menu. Something like:

[code]
image




[/code]

Do You get what I mean ?
(ofcourse the code above does not work!)
I'd also like to get rid of the titlebar of the popup window, so that the users won't see it as the popupwindow but as a popupmenu...

can anyone help me with that ?


;-)
-mac-
mailto:[email protected]
the Netherlands...

Comments

  • bgibbybgibby Posts: 251Member
    : I want to create a popup window on the position of the mouse. I want to use this for a popup menu. Something like:
    :
    : [code]
    : image
    :
    :
    :
    :
    : [/code]
    :
    : Do You get what I mean ?
    : (ofcourse the code above does not work!)
    : I'd also like to get rid of the titlebar of the popup window, so that the users won't see it as the popupwindow but as a popupmenu...
    :
    : can anyone help me with that ?
    :
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :

    Hi there,

    Yep I understand what you're trying to do.

    There's no way to actually remove the pop-up's Title bar. The only time the title bar is not present is during full screen mode in IE. NS still retains the title bar.

    So your only other way to do it is to use
    's.

    It also depends upon which browser you're trying to develop for.

    window.event.x and window.event.y give you the precise mouse coordinates. In your popup code, you can use these two to get where the mouse is when the function is fired.

    HTH
    Bradley q:)
  • mac_doggiemac_doggie Posts: 488Member
    : : I want to create a popup window on the position of the mouse. I want to use this for a popup menu. Something like:
    : :
    : : [code]
    : : image
    : :
    : :
    : :
    : :
    : : [/code]
    : :
    : : Do You get what I mean ?
    : : (ofcourse the code above does not work!)
    : : I'd also like to get rid of the titlebar of the popup window, so that the users won't see it as the popupwindow but as a popupmenu...
    : :
    : : can anyone help me with that ?
    : :
    : :
    : : ;-)
    : : -mac-
    : : mailto:[email protected]
    : : the Netherlands...
    : :
    : :
    :
    : Hi there,
    :
    : Yep I understand what you're trying to do.
    :
    : There's no way to actually remove the pop-up's Title bar. The only time the title bar is not present is during full screen mode in IE. NS still retains the title bar.
    :
    : So your only other way to do it is to use
    's.
    :
    : It also depends upon which browser you're trying to develop for.
    :
    : window.event.x and window.event.y give you the precise mouse coordinates. In your popup code, you can use these two to get where the mouse is when the function is fired.
    :
    : HTH
    : Bradley q:)
    :
    Thanks for your reply. I thought that I did see explorerwindows without titelbar, but I guess I'm wrong then. I thought of
    's too, but if I am using frames De popup menu won't appear over the other frame, it just creates a scrollbar in it's own frame (know what I mean?) If anyone can figure out a way to get rid of the titelbar please let me know... (I could allways create my own browser in VB hihi)


    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


  • borislavborislav Posts: 16Member
    : I want to create a popup window on the position of the mouse. I want to use this for a popup menu. Something like:
    :
    : [code]
    : image
    :
    :
    :
    :
    : [/code]
    :
    : Do You get what I mean ?
    : (ofcourse the code above does not work!)
    : I'd also like to get rid of the titlebar of the popup window, so that the users won't see it as the popupwindow but as a popupmenu...
    :
    : can anyone help me with that ?
    :
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :

    Hey there is a better way to do this:

    image


    function your_func(name){
    //name is the image name
    // mouse coordinates are
    var mx=event.clientX;
    var my=event.clientY;
    window.open("whereyougo.htm?mouseX="+mx+"&MouseY="+my,"","locationbar=no,toolbar=no,status=no");
    }


    in the function mx,my are mouse coordinates; name are the image name;
    if you want to catch on mouse move event simply change onMouseDown=... with onMouseMove.
    Note: this will work only IE.
  • bgibbybgibby Posts: 251Member
    : Hey there is a better way to do this:
    :
    : image
    :
    :
    : function your_func(name){
    : //name is the image name
    : // mouse coordinates are
    : var mx=event.clientX;
    : var my=event.clientY;
    : window.open("whereyougo.htm?mouseX="+mx+"&MouseY="+my,"","locationbar=no,toolbar=no,status=no");
    : }
    :
    :
    : in the function mx,my are mouse coordinates; name are the image name;
    : if you want to catch on mouse move event simply change onMouseDown=... with onMouseMove.
    : Note: this will work only IE.
    :

    window.event.x and window.event.y works in both IE4+ & NS4+

    Cya
    Bradley q:)
  • borislavborislav Posts: 16Member
    : : Hey there is a better way to do this:
    : :
    : : image
    : :
    : :
    : : function your_func(name){
    : : //name is the image name
    : : // mouse coordinates are
    : : var mx=event.clientX;
    : : var my=event.clientY;
    : : window.open("whereyougo.htm?mouseX="+mx+"&MouseY="+my,"","locationbar=no,toolbar=no,status=no");
    : : }
    : :
    : :
    : : in the function mx,my are mouse coordinates; name are the image name;
    : : if you want to catch on mouse move event simply change onMouseDown=... with onMouseMove.
    : : Note: this will work only IE.
    : :
    :
    : window.event.x and window.event.y works in both IE4+ & NS4+
    :
    : Cya
    : Bradley q:)
    :

    Hi Cya,
    You are completely right, but problem is to determine the exact mouse position in the object. Calculation that you must make on this way is more than you only determine browser and then you take the mouse position.

    Regards
    Borislav

Sign In or Register to comment.