Validar cedula y telf
Si me pueden ayudar por favor quiero que la cedula no sea menor que 8 números ni mayor que ocho números, y que no acepten puntos ni comas tanto en la cedula como en el telf. Agradecería su ayuda
//Validar cedula
function soloNumeros(evt){
if(window.event){// IE
keynum = evt.keyCode;
}else{
keynum = evt.which;
}
if((keynum>45 && keynum<58) || keynum == 8){
//if(keynum>47 && keynum<58){
return true;
}else{
return false;
}
}
<input name="CED1" type="text" id="CED1" style="FONT-WEIGHT: normal; FONT-SIZE: 8pt; FONT-STYLE: normal; FONT-FAMILY: 'Verdana'" onKeyPress="return soloNumeros(event)" size="10" maxlength="8"/>
function soloNumerosTELEF1(evt){
if(window.event){// IE
keynum = evt.keyCode;
}else{
keynum = evt.which;
}
if((keynum>45 && keynum<58) || keynum == 8){
//if(keynum>47 && keynum<58){
return true;
}else{
return false;
}
}
?<input type="TELEF1" name="TELEF1" id="TELEF1" onkeypress="return soloNumerosTELEF1(event)" size="20" maxlength="50"/>
?
//Validar cedula
function soloNumeros(evt){
if(window.event){// IE
keynum = evt.keyCode;
}else{
keynum = evt.which;
}
if((keynum>45 && keynum<58) || keynum == 8){
//if(keynum>47 && keynum<58){
return true;
}else{
return false;
}
}
<input name="CED1" type="text" id="CED1" style="FONT-WEIGHT: normal; FONT-SIZE: 8pt; FONT-STYLE: normal; FONT-FAMILY: 'Verdana'" onKeyPress="return soloNumeros(event)" size="10" maxlength="8"/>
function soloNumerosTELEF1(evt){
if(window.event){// IE
keynum = evt.keyCode;
}else{
keynum = evt.which;
}
if((keynum>45 && keynum<58) || keynum == 8){
//if(keynum>47 && keynum<58){
return true;
}else{
return false;
}
}
?<input type="TELEF1" name="TELEF1" id="TELEF1" onkeypress="return soloNumerosTELEF1(event)" size="20" maxlength="50"/>
?
Respuesta de krlosnow
1