Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Is there this mouse event for a DIV Control?

    Hi,

    Does a DIV control(context menu) have attribute or events which can detect mouse-clicks outside of the control?

    I read that there is an onclick event, div.attributes["onclick"], but the event is for mouse clicks within the control. Are there mouseclick events which can be detected outside of the control?

    e.g When the user clicks anywhere on the page, the context menu will dissapear.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,590
    Thanks
    0
    Thanked 644 Times in 634 Posts
    You would have to trigger the event handler for the body and then test if the mouse is inside the div.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •