Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/08/2007, 05:10
IngProd
 
Fecha de Ingreso: marzo-2007
Mensajes: 78
Antigüedad: 17 años, 2 meses
Puntos: 0
Mover capas ¿?

Hola a todos, tengo un sencillo ejemplo en javaScript y no me funciona en ninguno de los navegadores... y la verdad es que no entiendo por qué, ya que por lo menos en IE se que me ha funcionado otras veces ¿?¿?

Código:
<!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" />
<style type="text/css">
.miestilo{
	top:50px;
	left:250px;
	width:150px;
	height:150px;
	background:#FF0000;
}
</style>

<script language="javascript">
	function movercapa(){
		alert("mueve");
		alert(document.getElementById('capa').id);
		alert(document.getElementById('capa').style.top);
		y = document.getElementById('capa').style.top;
		y = parseInt(y);
		y += 15;
		document.getElementById('capa').style.top = y;
	}
</script>

<title>Documento sin t&iacute;tulo</title>
</head>

<body>
	<div id="capa" class="miestilo"></div>
	<a href="#" onclick="movercapa()">xxx</a>
</body>
</html>
El alert(document.getElementById('capa').style.top); sale en blanco, el resto como se espera... Qué puede estar mal ¿?
Muchas gracias!!