Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/02/2005, 14:00
Avatar de eft0
eft0
 
Fecha de Ingreso: junio-2003
Ubicación: Santiago - Chile
Mensajes: 635
Antigüedad: 20 años, 11 meses
Puntos: 9
Para validar esto al vuelo, es decir impedir que ingresen numeros seria algo asi:

<SCRIPT TYPE="text/javascript">
<!--
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place

// funcion modificada para que solo acepte string.
// eft0 - forosdelweb.com
function strOnly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) ||
(key==9) || (key==13) || (key==27) )
return true;

else if ((("aAbBcCdDeEfFgGhHiIjJkKlLmMnNñÑoOpPqQrRsStTuUvV wWxXyYzZ").indexOf(keychar) > -1))
return true;
else
return false;
}
//-->
</SCRIPT>


<INPUT NAME="dollar" SIZE=5 MAXLENGTH=5 onKeyPress="return strOnly(this, event)">