You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Crea una rutina que no permita que el ratón se coloque encima de una caja azul de 100 x 100 px. Cada vez que el ratón intente colocarse encima, la posición de la caja debe cambiar aleatoriamente por la página.</p>
<p><a href="index.html">volver atrás</a></p>
</header>
<main>
<div id="cuadrado"></div>
</main>
<script>
//crear la funcion para el movimiento del cuadrado
function movimiento(){
let x = Math.random() * (window.innerWidth - 100)
let y = Math.random() * (window.innerHeight - 100)
cuadrado.style.left = x + 'px'
cuadrado.style.top = y + 'px'
}
let cuadrado = document.getElementById('cuadrado')