SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict jasongr's Avatar
    Join Date
    Jul 2004
    Location
    usa
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to obtain the event.x and event.y in Mozilla and Opera

    Hello

    I have the following JavaScript code which works fine in IE:
    Code:
    <a href="#" onmouseover="func();">test</a>
    
    function func() {
       var left = event.pageX ? event.pageX : event.clientX + parent.document.body.scrollLeft;
       var top = event.pageY ? event.pageY : event.clientY + parent.document.body.scrollTop;
    
    // code continues here...
    }
    This doesn't work in Mozilla and Opera and I am guessing that the problem is in the way events are accessed.
    Can anyone show me the proper way of doing this in Mozilla and Opera?

  2. #2
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The event models in different browsers are not the same. Read more about Mozilla: http://www.mozilla.org/docs/dom/domr...event_ref.html

    And take time to visit: http://www.quirksmode.org/

  3. #3
    SitePoint Addict jasongr's Avatar
    Join Date
    Jul 2004
    Location
    usa
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot
    These are links are very useful.
    I will indeed investigate them

    regards

  4. #4
    SitePoint Addict jasongr's Avatar
    Join Date
    Jul 2004
    Location
    usa
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot
    These are links are very useful.
    I will indeed investigate them

    regards


Bookmarks

Posting Permissions

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