[javaEScript] Mover DIV con JavaScript recursivamente
"Hernán Beati - SaberWeb.com.ar"
hernan en saberweb.com.ar
Mar Jun 12 12:49:45 PDT 2007
Hola a todos!
¿Cuál puede ser el error en este código?
No logro darme cuenta.
Saludos!
Hernán.-
<html>
<head>
<title>prueba</title>
<script type="text/javascript">
function mover(){
miObjeto = document.getElementById('cosa');
x = parseInt(miObjeto.style.left);
y = parseInt(miObjeto.style.top);
x = x + 10;
y = y + 10;
miObjeto.style.left = x + 'px';
miObjeto.style.top = y + 'px';
if (miObjeto.style.left<900){
mover();
}
}
</script>
<style type="text/css">
<!--
#cosa {
position:absolute; left:1200px; top:67px; width:209px; height:253px;
z-index:1;
}
-->
</style>
</head>
<body onload="mover()">
<div id="cosa">
<h1>holaaaaaaa</h1>
<h1>aaaaaaaaaa</h1>
</div>
</body>
</html>
Más información sobre la lista de distribución javaEScript