Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/12/2011, 17:42
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
como saber cuantos input hay con javascrit

como saber cuantos input hay con javascrit si se fijan hay dos iguales y uno es diferente, como puedo saber la suma de los input iguales
yo lo hice asi pero no me sale
algiuien me puede decir como
gracias


Código Javascript:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Documento sin t&iacute;tulo</title>
  6.     <script language="javascript">
  7.     function a(){
  8.     var donde = document.getElementById('saber');
  9.     max = donde.getElementsByIdTagName('input').length;
  10.     alert("Cantidad de inputs: "+ max);
  11.                 }
  12.     </script>
  13.  
  14. </head>
  15.  
  16. <body>
  17.     <form action="" method="get">
  18.     <input name="" type="text" id="saber" />
  19.      <input name="" type="text"  id="saber"/>
  20.       <input name="" type="text"  id="diferente"/>
  21.     <input name="" type="button"  onclick="a()"/>
  22.     </form>
  23. </body>
  24. </html>