Buenos días.
Tras haber hecho varias pruebas, em encuentro con un problema.
En IE y Firefox, funciona correctamente, pero en Opera no.
La situación es la siguiente:
Tengo un documento, con una celda de un color, y quiero posicionar sobre esa celda una capa.
Para ello uso este código:
Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript1.1" type="text/javascript">
function recolocar()
{
// alert("X = " + document.getElementById("contenido").offsetLeft + " Y = " + document.getElementById("contenido").offsetTop)
document.getElementById("capa").style.top = document.getElementById("contenido").offsetTop;
document.getElementById("capa").style.left = document.getElementById("contenido").offsetLeft;
}
</script>
</head>
<body style="margin:0px" onload="recolocar()">
<table cellpadding="0" cellspacing="0" style="width:100%;height:100%" border="0">
<tr>
<td width="100%" height="100%" valign="middle" align="center">
<table cellpadding="0" cellspacing="0" style="width:200px;height:20px" border="0">
<tr>
<td width="200" height="20" bgcolor="#0000ff" id="contenido" style="position:relative">dasdsadsa</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="capa" style="visibility:visible;z-index:5;position:absolute;top:0px;left:0px;width:150px;height:200px;border:1px solid Red">
<table cellpadding="0" cellspacing="0" style="width:150px;height:200px;background-color:green" border="0">
<tr>
<td width="100%" height="100%">CAPA</td>
</tr>
</table>
</div>
</body>
</html>
Me gustaría que alguien me dijera porque en Opera, las propiedades
offsetTop y
offsetTop de una celda (en posición relativa) me dan como valores
0.
Espero alguna aclaración.
Muchas gracias