Ver Mensaje Individual
  #11 (permalink)  
Antiguo 31/08/2013, 10:39
Avatar de jor_0203
jor_0203
 
Fecha de Ingreso: octubre-2011
Ubicación: mexico
Mensajes: 760
Antigüedad: 12 años, 6 meses
Puntos: 8
Respuesta: hay una forma con javascript de que si el url no existe te lleve a otra

un amigo me dijo que es de esta forma pero no me sale
son tres paginas web
la primera tiene url
la segunda tiene el direccionamiento
la tercera es la que lleva
pongo aqui el codigo haber que es lo que esta mal ya que a mi no me sale
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <title>Bienvenido a nuestro sitio</title>
  4.     <script src="guion02-10.js" type="text/javascript" language="javascript">
  5.     </script>
  6. </head>
  7. <body bgcolor="#FFFFFF">
  8.     <h2 align="center">
  9.         <a href="noExiste.php"  id="redirigir">Bienvenido a nuestro sitio... ¡Pase!</a>
  10.     </h2>
  11. </body>
  12. </html>
segunda checa y manda
Código Javascript:
Ver original
  1. window.onload = 'initAll';
  2. function initAll() {
  3.    document.getElementById('redirigir').onclick = iniciarRedirecc();
  4. }
  5.  
  6. function iniciarRedirecc() {
  7.    window.location = 'jswelcome.html';
  8.    return false;
  9. }
y la tercera es donde la direcciono
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <title>Nuestro sitio</title>
  4. </head>
  5. <body bgcolor="#FFFFFF">
  6. <h1>Bienvenido a nuestro sitio, repleto de características avanzadas de JavaScript.</h1>
  7. </body>
  8. </html>

espero haber explicado bien y ojala a ustedes les salga

Última edición por jor_0203; 31/08/2013 a las 10:49