Ver Mensaje Individual
  #5 (permalink)  
Antiguo 20/04/2016, 10:32
machupichu121
 
Fecha de Ingreso: abril-2016
Mensajes: 5
Antigüedad: 8 años
Puntos: 0
Respuesta: redirigir a otro web

[QUOTE=w3w3b;4789826]
Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="en" onclick="prueba()">
  3.     <meta charset="UTF-8">
  4.     <title>Redireccion</title>
  5.     <script type="text/javascript">
  6.         function prueba(){
  7.             window.location.href="http://www.google.es";
  8.         }
  9.     </script>
  10. </head>
  11. <body >
  12.  
  13. </body>
  14. </html>

perfecto gracias,pero la funcion se repite una y otra vez
como puedo hacer que solo se repita una vez
te dejo el ejemplo como lo tengo

<!DOCTYPE html>
<html lang="en" onclick="prueba()">
<head>
<meta charset="UTF-8">
<title>Redireccion</title>

<script type="text/javascript">
var bar = 0;

function prueba(){
do {
console.log (bar++);
window.open("http://www.google.com");
}while (bar < 1);

}

</script>
</head>
<body >

</body>
</html>