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" );
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" );
Comment