Hola,
Trato de posisionar un div en la posison de un link.
El link no tiene una posision fija:
Código HTML:
<!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>Prueba</title>
<style type="text/css">
#div1{
position:absolute;
width:260px;
background-color:#FFFFFF;
color:#000000;
top:71px;
left:785px;
text-decoration: none;
height: auto;
}
</style>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
function posision_imput(id,id_p){
var top=$(id).style.pixelTop;
var left=$(id).style.pixelLeft;
$(id_p).style.top=top;
$(id_p).style.left=left;
alert('Posisionado a '+top+' '+left);
}
</script>
</head>
<body><br />
<br />
<br />
<br />
<br />
<br />
<a href="#" onclick="posision_imput('a2','div1');return false;">Posisionar</a>
<br />
<br />
<br />
<br />
<div align="left" id="div1">Texto1</div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<a id="a2"> </a>Texto2
</body>
</html>
Gracias
Salu2