Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/04/2005, 13:03
angsanchez
 
Fecha de Ingreso: octubre-2004
Ubicación: España
Mensajes: 894
Antigüedad: 22 años
Puntos: 3
Hola, arameo
Es cuestión de ir recorriendo el texto y aplicando todos los criterios de verificación que se te ocurran. Algo así:
Código PHP:
function validaFecha(dato) {
    if (
dato.length!=10) { alert ("formato incorrecto"); return false }
    if (
dato.charAt(2)!="/" || dato.charAt(4)!="/") alert ("formato incorrecto"); return false }
    var 
datos = dato.split("/")
    var 
dia = datos[0], mes = datos[1], anno = datos[2]
    if (
dia != parseInt(dia)) { alert ("formato incorrecto"); return false }
    if (
mes != parseInt(mes)) { alert ("formato incorrecto"); return false }
    if (
anno != parseInt(anno)) { alert ("formato incorrecto"); return false }
    if (
dia>31 || mes>12) { alert ("formato incorrecto"); return false }
} 
__________________
Angel :cool: