Tema: pinche for
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/11/2011, 18:41
mrkin
 
Fecha de Ingreso: noviembre-2011
Mensajes: 12
Antigüedad: 12 años, 5 meses
Puntos: 0
Respuesta: pinche for

SI, si hay "href"
aqui el completo
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<title>prueba</title>


</head>

<body>

<a href="http://www.prueba1.com">1 aa</a>
<a href="http://www.prueba2.com">2 t</a>
<a href="http://www.prueba3.com">3</a>
<a href="http://www.prueba4.com">4</a>
<a href="http://www.prueba5.com">5</a> 
Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. var enlaces = document.getElementsByTagName("a");
  3. var dir = "http://www.prueba";
  4. var numero = 0;
  5.  
  6. for (i=0; i <6 ;i=i+1)
  7. {  
  8.     b = enlaces[i].toString();
  9.     c = b.slice(0,17);
  10.         if (c==dir)
  11.         {
  12.         numero = numero + 1;
  13.         }
  14.         alert(numero+" veces fueron iguales");
  15. }
  16.  
  17.  
  18. </script>




</body>
</html>

Última edición por mrkin; 07/11/2011 a las 06:59