Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/05/2005, 18:40
kepawe
 
Fecha de Ingreso: agosto-2004
Mensajes: 157
Antigüedad: 19 años, 8 meses
Puntos: 5
Vaya, no me he dado cuen y he mezclado el valor type y name

Lo envió de nuevo.

Código:
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--


function check_form(current_form){

	for(var ctr = 0; cf = current_form[ctr];ctr++){
	      
			if(cf.getAttribute("datatype") == "int") {
			// sentencia para validar número
			alert("Validar números")
			}
			else if(cf.getAttribute("datatype") == "char"){
			// sentencia para validar texto
			 alert("Validar texto")
			}
					
	}

}

//-->
</script>

</head>
<body>
<form name="form1">
<input type="text" name="texto1" datatype="int">
<input type="text" name="texto2" datatype="char">

<input type="button" value="validar" onclick="check_form(this.form)">
</form>
</body>
</html>
Saludos