mpartarrieu
Programmer
This code is working perfectly on IE, but not on Firefox or Opera. It basically shows a hidden div when onmouseover an image and the hides it again. It also place the div on the right corner of the image. Any ideas would be appreciated. Thanks in advance.
<code>
var cm=null;
document.onclick = new Function("show(null)");
function getPos(el,sProp)
{
var iPos = 0;
while (el!=null)
{
iPos+=el["offset" + sProp];
el = el.offsetParent;
}
return iPos;
}
function show(el,m)
{
if (m)
{
m.style.display='';
m.style.pixelLeft = getPos(el,"Left") + el.offsetWidth;
m.style.pixelTop = getPos(el,"Top");
}
if ((m!=cm) && (cm)) cm.style.display='none';
cm=m;
}
<code>
<code>
var cm=null;
document.onclick = new Function("show(null)");
function getPos(el,sProp)
{
var iPos = 0;
while (el!=null)
{
iPos+=el["offset" + sProp];
el = el.offsetParent;
}
return iPos;
}
function show(el,m)
{
if (m)
{
m.style.display='';
m.style.pixelLeft = getPos(el,"Left") + el.offsetWidth;
m.style.pixelTop = getPos(el,"Top");
}
if ((m!=cm) && (cm)) cm.style.display='none';
cm=m;
}
<code>