Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/04/2007, 04:55
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años, 8 meses
Puntos: 834
Re: encontrar la posicion absoluta

A ver si te sirve algo así:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>test</title>
<
script>
function 
getElementPosition(elemID) {
var 
offsetTrail document.getElementById(elemID);
var 
offsetLeft 0;
var 
offsetTop 0;
while (
offsetTrail) {
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
offsetTrail offsetTrail.offsetParent;
}
if (
navigator.userAgent.indexOf("Mac") != -&& typeof document.body.leftMargin != "undefined" && navigator.appName=="Microsoft Internet Explorer" ) {
offsetLeft += parseInt(document.body.leftMargin);
offsetTop += parseInt(document.body.topMargin);
}
return {
left:offsetLefttop:offsetTop};
}
</script>

</head>

<body>
<div id="uno" style="border:1px solid #000000; cursor:pointer" onclick="alert('left:'+getElementPosition(this.id).left+',top:'+getElementPosition(this.id).top)">capa1</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<div id="dos" style="border:1px solid #000000; cursor:pointer" onclick="alert('left:'+getElementPosition(this.id).left+',top:'+getElementPosition(this.id).top)">capa2</div>
</body>
</html>