Foros del Web » Programando para Internet » Javascript »

[SOLUCIONADO] ¿Error: Event is not defined en firefox, en una funcion?

Estas en el tema de ¿Error: Event is not defined en firefox, en una funcion? en el foro de Javascript en Foros del Web. Muy buenos dias estimados compañeros me sale el siguiente error: ¿Error: Event is not defined y mi funcion en javascript es la siguiente: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); ...
  #1 (permalink)  
Antiguo 04/07/2013, 06:46
 
Fecha de Ingreso: junio-2009
Ubicación: Bolivia
Mensajes: 96
Antigüedad: 14 años, 10 meses
Puntos: 0
¿Error: Event is not defined en firefox, en una funcion?

Muy buenos dias estimados compañeros me sale el siguiente error:
¿Error: Event is not defined y mi funcion en javascript es la siguiente:
Código Javascript:
Ver original
  1. window.onkeydown = captura_ascii;
  2. function captura_ascii(e){
  3.     var numero_de_tecla_pulsada;
  4.    
  5.     if(window.event){ //cosas de IE
  6.        var numero_de_tecla_pulsada = e.keyCode //recoge en IE el valor ASCII de la tecla
  7.     }
  8.     else if(e.which){  // Cosas Netscape/Firefox/Opera
  9.         var numero_de_tecla_pulsada = e.which //recoge valor ASCII en otros navegadores
  10.     }
  11.     /* obtiene el caracter correspondiente al codigo ASCII recogido */    
  12.  return numero_de_tecla_pulsada;
  13. }
  14.  
  15.  
  16.  
  17.  
  18. function BorrarDatosRemitente(id1,id2,id3)
  19. {
  20.     //capturando el codigo assci
  21.       //*****ERROR EN ESTA LINEA
  22.      var teclaASCII = captura_ascii(event);
  23.     if(teclaASCII==8)
  24.     {
  25.      document.getElementById(id1).value="";
  26.      document.getElementById(id2).value="";
  27.      document.getElementById(id3).value="";            
  28.     }
  29.     ///alert('Tecla: '+teclaCHAR+'\nCódigo: '+teclaASCII)
  30.     //document.getElementById(id1).value="";
  31.     //document.getElementById(id2).value="";
  32. }

En el lugar que esta marcado con:"*****ERROR EN ESTA LINEA",SALE ESE ERROR, y lo llamo de la siguiente forma en html:
Código HTML:
Ver original
  1. <input type="text" id="buscar_usuario" name="buscar_usuario"
  2. onkeydown = "BorrarDatosRemitente('txDirRemitente','txTelRemitente','txEmailRemitente');" />

El codigo debe funcionar tanto en IE y firefox, en un servidor WEB BAJO WINDOWS FUNCIONA BIRN, SIN EMBARGO BAJO LINUX NO FUNCIONA, YA QUE LINUX ES BIEN ESTRICTO....POR FAVOR SUS COMENTARIOS Y SALUD2 Y GRACIAS DE ANTEMANO.
  #2 (permalink)  
Antiguo 04/07/2013, 07:10
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 1 mes
Puntos: 574
Respuesta: ¿Error: Event is not defined en firefox, en una funcion?

Código Javascript:
Ver original
  1. function BorrarDatosRemitente(id1,id2,id3,e)
  2. {
  3.     //capturando el codigo assci
  4.       //*****ERROR EN ESTA LINEA
  5.      var teclaASCII = captura_ascii(e);
  6.     if(teclaASCII==8)
  7.     {
  8.      document.getElementById(id1).value="";
  9.      document.getElementById(id2).value="";
  10.      document.getElementById(id3).value="";            
  11.     }
  12.     ///alert('Tecla: '+teclaCHAR+'\nCódigo: '+teclaASCII)
  13.     //document.getElementById(id1).value="";
  14.     //document.getElementById(id2).value="";
  15. }

Código HTML:
Ver original
  1. <input type="text" id="buscar_usuario" name="buscar_usuario"
  2. onkeydown = "BorrarDatosRemitente('txDirRemitente','txTelRemitente','txEmailRemitente',event);" />

Te falta pasar el event....
__________________
Quim
--------------------------------------------------
Ayudar a ayudar es una buena práctica!!! Y da buenos resultados.
  #3 (permalink)  
Antiguo 04/07/2013, 07:31
 
Fecha de Ingreso: junio-2009
Ubicación: Bolivia
Mensajes: 96
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: ¿Error: Event is not defined en firefox, en una funcion?

quimfv, gracias bron, funciono de 10...salu2

Etiquetas: event, firefox, funcion, html, input
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:24.