Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/03/2013, 17:33
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 17 años, 8 meses
Puntos: 1567
Respuesta: Duda formulario HTML y javascript

Pero el problema cual es

Código HTML:
Ver original
  1. <script type="text/javascript">
  2. //<![CDATA[
  3. function valida(){
  4. var f = document.getElementById('xa');
  5. alert(f.nombre.value);
  6. return false;
  7. }
  8.  
  9. function valida2(frm){
  10. alert(frm.nombre.value);
  11. return false;
  12. }
  13. //]]>
  14.  
  15. <form id="xa">
  16. <input type="text" name="nombre">
  17. <input type="button" onclick="return valida()" value="val" />
  18. </form>
  19.  
  20. <form onsubmit ="return valida2(this)";>
  21. <input type="text" name="nombre">
  22. <input type="submit" onclick=" value="val" />
  23. </form>

incluso podrías poner simplemente un id al campo de texto y validar contra ese elemento

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.