Web Analytics Made Easy -
StatCounter How to retrieve image position? - CodingForum

Announcement

Collapse
No announcement yet.

How to retrieve image position?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to retrieve image position?

    Hello

    Is there a possibility to get the position of an image on mac IE4.x browsers? I've tried several things, but without success. Does anybody have a solution? Thank you.

    Following code works fine for almost all browsers except IE4.x on mac:

    function getImgLeft( id )
    {
    if ( document.getElementById || document.all )
    {
    return getParentLeft( document.images[id] );
    }
    else if ( document.layers )
    {
    return document.images[id].x;
    }
    }

    function getParentLeft( obj )
    {
    if ( obj.offsetParent )
    {
    return obj.offsetLeft + getParentLeft( obj.offsetParent );
    }
    else
    {
    if ( obj.offsetLeft ) return obj.offsetLeft;
    else return 0;
    }
    }

    var left = getImgPos( "imagename" );

  • #2
    layers?

    Would wrapping the image in a layer the exact size of the image allow you to get a position on it?

    The only other thing I was thinking is that IE is near viral in its installs where your users will be getting updates. So unless you know of an actual user group that has the 4.x browsers installed on the Mac's. I would just do a browser detect in the beginning and tell the 4.x users to upgrade to 5.0/5.5.

    I am getting to the point where I dont think anyone should use less then IE 5.0. As far as Netscape goes... I am hoping the last of the holdouts on 4.7x will just change over to IE 5.0. (my company included) The 4.x browsers are just crap. And its 2002...

    -S. Bob

    Comment

    Working...
    X