Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

validate text on netscape

Status
Not open for further replies.

renaldo31

IS-IT--Management
Feb 11, 2002
9
MX
I need help, I have a code to validate the text input in a field, if the field only accept letters or numbers, it works find in IE and Netscape.

The problem is when I put characters like á, é, í, netscape is closed in that moment.


this is the code an I call the function in:
<body leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; bgcolor=&quot;#ffffee&quot; OnLoad=&quot;obtenNavegador(); habilitaEV();&quot;>

I hope somebody can help me


function obtenNavegador() {
strExplorador = navigator.appName;

//Validaciones para algunas variables de inicio
nbCtrlNotiene=document.forms[0].chkNotiene.value;
var control=document.forms[0].egeneral_icrediticia;
if (control.options[control.selectedIndex].text.toUpperCase()==&quot;NO TENGO&quot;) {
NoCreditos=true;
}
return;
}

/******************************************************************************
funcion habilitaEV
******************************************************************************/
function habilitaEV(){
if (strExplorador.indexOf(&quot;Explorer&quot;,0) == -1) {
document.captureEvents(Event.KEYDOWN);
document.onkeydown=validaTecla;
}
return;
}

/******************************************************************************
funcion validaTecla
******************************************************************************/
function validaTecla(evento) {
var bolRegreso=false;
var control=evento.target.name;

if (control==&quot;itotal_ifinanciera&quot; || control == &quot;estado_ipersonal&quot; || control == &quot;ciudad_ipersonal&quot; || control == &quot;delegacion_ipersonal&quot;
|| control == &quot;estado_ibienes&quot; || control == &quot;ciudad_ibienes&quot; || control == &quot;delegacion_ibienes&quot;
|| control == &quot;estado_ilaboral&quot; || control == &quot;ciudad_ilaboral&quot; || control == &quot;delegacion_ilaboral&quot;
|| control == &quot;estadoa_ilaboral&quot; || control == &quot;ciudada_ilaboral&quot; || control == &quot;delegaciona_ilaboral&quot;) {
bolRegreso = false;
} else if (control == &quot;nombre_ipersonal&quot; || control == &quot;nombre2_ipersonal&quot; || control == &quot;paterno_ipersonal&quot; || control == &quot;materno_ipersonal&quot; || control == &quot;rfca_ipersonal&quot;) {
bolRegreso = validaLetras(evento);
} else if (control == &quot;lada_ilaboral&quot; || control == &quot;lada_ipersonal&quot; || control == &quot;telefono_ipersonal&quot; ||
control == &quot;tiempo_ibienes&quot; || control == &quot;dependientes_ipersonal&quot; || control == &quot;antiguedad_ilaboral&quot; ||
control == &quot;antiguedada_ilaboral&quot; || control == &quot;imensual_ifinanciera&quot; || control == &quot;ifijo_ifinanciera&quot; ||
control == &quot;itotal_ifinanciera&quot; || control == &quot;tcredito_icrediticia&quot; || control == &quot;mcredito_icrediticia&quot; ||
control == &quot;scredito_icrediticia&quot; || control == &quot;pcredito_icrediticia&quot; || control == &quot;auto_ibienes&quot; ||
control == &quot;lada_ilaboral&quot; || control == &quot;extension_ilaboral&quot; || control == &quot;telefono_ilaboral&quot; ||
control == &quot;anio_ipersonal&quot; || control == &quot;rfcb_ipersonal&quot; || control == &quot;anio_ipersonal&quot;


//codigo del cambio
/*control == &quot;numeroext_ipersonal&quot; || control == &quot;numeroint_ipersonal&quot; ||
control == &quot;numeroext_ibienes&quot; || control == &quot;numeroint_ibienes&quot; ||
control == &quot;numeroext_ilaboral&quot; || control == &quot;numeroint_ilaboral&quot; ||
control == &quot;numeroexta_ipersonal&quot; || control == &quot;numerointa_ipersonal&quot; */
//termina cambio






) {
bolRegreso = validaNumeros(evento);
} else if(control == &quot;rfcc_ipersonal&quot;){
bolRegreso = validaLetrasNum(evento);
} else if (control == &quot;correo_ipersonal&quot;) {
bolRegreso = validaCorreo_kp(evento);
} else if (control == &quot;calle_ipersonal&quot; || control == &quot;calle_ibienes&quot; || control == &quot;calle_ilaboral&quot; || control == &quot;callea_ilaboral&quot; ||
control == &quot;numeroext_ipersonal&quot; || control == &quot;numeroint_ipersonal&quot; ||
control == &quot;numeroext_ibienes&quot; || control == &quot;numeroint_ibienes&quot; ||
control == &quot;numeroext_ilaboral&quot; || control == &quot;numeroint_ilaboral&quot; ||
control == &quot;numeroexta_ipersonal&quot; || control == &quot;numerointa_ipersonal&quot; || control == &quot;nombre_ilaboral&quot;) {
bolRegreso = validaCalle_kp(evento);
} else if (control == &quot;nacimiento_ipersonal&quot;) {
bolRegreso = validaFecha_kp(evento);
} else if (control == &quot;rfc_ipersonal&quot;) {
bolRegreso = validaRFC_kp(evento);
} else if (control == &quot;cp_ipersonal&quot;){
bolRegreso = validaNumeros(evento);
//Tiene que validar otras cosas
if (bolRegreso) {
validaCP_kdown(evento);
}
} else if(control == &quot;cp_ibienes&quot;){
bolRegreso = validaNumeros(evento);
//Tiene que validar otras cosas
if (bolRegreso) {
validaCP1_kdown(evento);
}
} else if(control == &quot;cp_ilaboral&quot;){
bolRegreso = validaNumeros(evento);
//Tiene que validar otras cosas
if (bolRegreso) {
validaCPlab_kdown(evento);
}
} else if(control == &quot;cpa_ilaboral&quot; ) {
bolRegreso = validaNumeros(evento);
//Tiene que validar otras cosas
if (bolRegreso) {
validaCPlaba_kdown(evento);
}
}
else if (control == &quot;modelo_ibienes&quot;) {
bolRegreso = validaNumeros(evento);
//Tiene que validar otras cosas
if (bolRegreso) {
validaModelo_kdown(evento);
}
} else {
bolRegreso = true;
}
return bolRegreso;
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top