J
Jes
I have an image and on Click I want to display a table with 3 rows
showing options (similar to menu)
I would like to display this table exactly beneath and to the left of
the image.
I am using the following code:
function findPos(elemID) {
var offsetTrail = document.getElementById(elemID);
var offsetLeft = 0;
var offsetTop = 0;
while (offsetTrail)
{
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
offsetTrail = offsetTrail.offsetParent;
}
return { left: offsetLeft, topffsetTop };
}
function show_coords(event,layername,imagename)
{
var ff=document.getElementById(imagename);
var hh=ff.height;
var ww=ff.width;
var ff=document.getElementById(layername);
ff.style.top=findPos(imagename).top;
ff.style.left=findPos(imagename).left;
}
The layername is being displayed almost in the middle of the image.
Can someone tell me why please ?
showing options (similar to menu)
I would like to display this table exactly beneath and to the left of
the image.
I am using the following code:
function findPos(elemID) {
var offsetTrail = document.getElementById(elemID);
var offsetLeft = 0;
var offsetTop = 0;
while (offsetTrail)
{
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
offsetTrail = offsetTrail.offsetParent;
}
return { left: offsetLeft, topffsetTop };
}
function show_coords(event,layername,imagename)
{
var ff=document.getElementById(imagename);
var hh=ff.height;
var ww=ff.width;
var ff=document.getElementById(layername);
ff.style.top=findPos(imagename).top;
ff.style.left=findPos(imagename).left;
}
The layername is being displayed almost in the middle of the image.
Can someone tell me why please ?