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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Whats the difference between event.screen, eventclient, eventoffset, and event.x?

    I was at the following site,
    http://www.w3schools.com/dhtml/dhtml_object_event.asp

    and basically, i was going through the explanations of what each event meant, and to be honest, they all seemed the same to me. I hardly see any real difference between all the following:

    On the screenX, and screenY:
    Code:
    function coordinates()
    {
    x=event.screenX
    y=event.screenY
    alert("X=" + x + " Y=" + y)
    }
    On the clientX, and clientY:
    Code:
    function show_coords()
    {
    x=event.clientX
    y=event.clientY
    alert("X coords: " + x + ", Y coords: " + y)
    }
    On the X, and Y, coordinates:
    Code:
    function coordinates()
    {
    x=event.x
    y=event.y
    alert("X=" + x + " Y=" + y)
    }
    The offsetX, and offsetY, coordinates:
    Code:
    function coordinates()
    {
    x=event.offsetX
    y=event.offsetY
    alert("Horizontal=" + x + " Vertical=" + y)
    }
    To be perfectly honest, they all seemed to report the same thing when you put any of the codes in an actual page. I didnt see any difference really between any of the above, other than, they had different names.
    LovesWar

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    some are Moz only, some are IE only. not sure where standards come in (use object detection and you'll be fine). some pertain to position in relation to window, whilst others relate to position in relation to containing element.
    *keep it simple (TM)

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Some of those events are specific to the browser window while others are specific to the document, test them and then scroll the page down a ways and test them again to see the difference.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #4
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts
    from jbot:

    some are Moz only, some are IE only. not sure where standards come in (use object detection and you'll be fine). some pertain to position in relation to window, whilst others relate to position in relation to containing element.
    from Roy

    Some of those events are specific to the browser window while others are specific to the document, test them and then scroll the page down a ways and test them again to see the difference.
    I dont "suppose" either of you could point to links that would make a comparison distinction between the 2?

    As i said, i got most of the codes from the W3scools website. They didnt go too in depth in the differences between the 2 main browsers.
    LovesWar

  • #5
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.webdevelopersjournal.com/...jsevents3.html
    Code:
    clientX 	Mouse pointer X coordinate relative to window
    clientY 	Mouse pointer Y coordinate relative to window
    offsetX 	Mouse pointer X coordinate relative to element that fired the event
    offsetY 	Mouse pointer Y coordinate relative to element that fired the event

  • #6
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I checked out the site. Wasnt bad. The only real difference that i found was that offSet works in relation to the over-all area of something like a block, or a layer, and i would presume, a table. Here's the example used:

    http://www.webdevelopersjournal.com/...s3/Offsets.htm

    According to the source code of that site, this is all that was really said:

    Code:
    <HTML>
    <HEAD>
    <TITLE>Offsets</TITLE>
    
    <SCRIPT>
    
    function statusreport() {
    status = 'offsetX : ' + event.offsetX +' , offsetY : ' + event.offsetY;
    }
    
    </SCRIPT>
    </HEAD>
    
    <BODY>
    <DIV onmousemove="statusreport();" style="position:absolute;top:100;left:100;height:200;width:200;background-color:blue"></DIV>
    </BODY>
    </HTML>
    It didnt much talk about x, y, and screenY, and screenX. If either of the aforementioned properties relate to anything other than IE, it was not stated on the link given.

    There was another example though that sort of confused me. There was one example that tried to juxstapose the difference between clientX, and offSetX, but from what i saw, neither really differed from the other. One would have thought that the minute one stepped outside the bounding box, that the coordinate registration would stop for one property, but not for the other. This wasnt the case though. Even when i made circles with the cursor in the area outside the blue box, the status window still reflected changes in the messages associated with a particular property. I found that odd.

    Here is the exact example:

    http://www.webdevelopersjournal.com/...3/Offsets2.htm

    Well, maybe later this week i will figure something out. MSDN has a lot of interesting methods, objects, and properties.
    Last edited by SpiritualStorms; 10-29-2004 at 10:50 AM.
    LovesWar

  • #7
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by SpiritualStorms
    It didnt much talk about x, y, and screenY, and screenX. If either of the aforementioned properties relate to anything other than IE, it was not stated on the link given.
    these are Netscape-only properties. i would point you to Devedge, but as well know, those AOL twats removed it. you could always google tho*

    *the internet is great
    *keep it simple (TM)

  • #8
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jbot
    these are Netscape-only properties. i would point you to Devedge, but as well know, those AOL twats removed it. you could always google tho*

    *the internet is great
    go here to save googling:
    http://www.codingforums.com/showthread.php?t=46294


  •  

    Posting Permissions

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