11/12/2009, 07:03
|
| | Fecha de Ingreso: mayo-2006
Mensajes: 49
Antigüedad: 18 años, 9 meses Puntos: 2 | |
Respuesta: problemas al validar cadena de caracteres con todas sus consecuencias puedes hacer una funcion simple en javascript. Algo así:
function isAlphanumeric(txt)
{
var ascii = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ0123456789";
var i=0;
for (i=0;i<txt.length;i++)
{
if (ascii.indexOf(txt.charAt(i))==-1) {
return false;
}
}
return true;
}
No la he probado, igual hay algún fallo.
Tampoco he incluido el caracter espacio como alfanumérico, pero puedes añadirlo tu en el string "ascii". |