Foros del Web » Programando para Internet » Javascript »

[SOLUCIONADO] no dispara funcion

Estas en el tema de no dispara funcion en el foro de Javascript en Foros del Web. Ayuda, tengo varios combos que funcionan bien pero hay un combo que no dispara la funcion que llena una tabla de datos.Agradezco sus ideas. Esta ...
  #1 (permalink)  
Antiguo 06/06/2014, 08:13
 
Fecha de Ingreso: noviembre-2013
Mensajes: 147
Antigüedad: 10 años, 5 meses
Puntos: 1
no dispara funcion

Ayuda, tengo varios combos que funcionan bien pero hay un combo que no dispara la funcion que llena una tabla de datos.Agradezco sus ideas.

Esta es la parte del combo que llama la funcion. (los otros Combos estan igual y si funcionan).

Código Java:
Ver original
  1. <div id ="div_ramox">
  2.            <select name="RAMO" ID="RAMOX"  onchange="javascript:cargarCombo('CargaTablaSuc.jsp', 'RAMOX', 'div_tablax')" id="RAMOX"  style="width:300px;">
  3.            <%
  4.               out.println("<option value=0 >Seleccione un Ramo...</option>" );
  5.               //for (int i=0;i<listaEcoRamos.size();i++)
  6.               //{
  7.               //out.println("<option value="+listaEcoRamos.get(i).getcodigo()+">"+listaEcoRamos.get(i).getdescripcion()+"</option>" );
  8.               //}        
  9.            %>
  10.            </select>
  11.         </div>

Y la funcion pues lo que hace es redirigir a otra pagina que llena una tabla...

Código Javascript:
Ver original
  1. function cargarCombo (url, comboAnterior, element_id){  
  2.      
  3.     var element =  document.getElementById(element_id);
  4.     var valordepende = document.getElementById(comboAnterior);
  5.     var x = valordepende.value;    
  6.     var xs = valordepende.options[valordepende.selectedIndex].text;   // nombre
  7.    
  8.     var fragment_url = url+"?id="+x+"&sw=0";
  9.    
  10.     peticion.open("GET", fragment_url);
  11.     peticion.onreadystatechange = function(){
  12.         if (peticion.readyState === 4){
  13.             //escribimos la respuesta
  14.             element.innerHTML = peticion.responseText;
  15.         }
  16.     };
  17.    peticion.send(null);
  18.    //***********************************
  19.    //PARTE PARA LA TABLA DE DATOS
  20.    //***********************************
  21.     alert(x);
  22.     var valorSOD = document.getElementById("SUCX");  //SOD = Sucursal Oficina Director
  23.     var S = valorSOD.value;    
  24.     var xS = valorSOD.options[valorSOD.selectedIndex].text;   // nombre
  25.    
  26.     var valorSOD2 = document.getElementById("OFIX");
  27.     var O = valorSOD2.value;    
  28.     var xO = valorSOD2.options[valorSOD2.selectedIndex].text;   // nombre
  29.  
  30.     if (document.getElementById("DIRX")===null){
  31.        var D=0;
  32.     } else {
  33.          var valorSOD3 = document.getElementById("DIRX");
  34.          var D = valorSOD3.value;    
  35.     }
  36.  
  37.     if (document.getElementById("RAMOX")===null){
  38.        var R=0;
  39.     } else {
  40.          var valorSOD4 = document.getElementById("RAMOX");
  41.          var R = valorSOD4.value;    
  42.     }
  43.    //###################################33
  44.    
  45.     var element2 =  document.getElementById("div_tablax");
  46.    
  47.     if (comboAnterior==="SUCX"){
  48.         Nivel=1;
  49.     }  else if (comboAnterior==="OFIX"){
  50.         Nivel=2;
  51.     } else if (comboAnterior==="DIRX"){
  52.         Nivel=3;
  53.     } else if (comboAnterior==="RAMOX" && S!==0 && O===0){
  54.         Nivel=4;
  55.     } else if (comboAnterior==="RAMOX" && S!==0 && O!==0){
  56.         Nivel=5;
  57.     }    
  58.     var fragment_url2 = "CargaTablaSuc.jsp?id="+x+"&nm="+xs+"&Nivel="+Nivel+"&idR="+R+"&sw=0";
  59.    
  60.     pet2.open("GET", fragment_url2);
  61.     pet2.onreadystatechange = function(){
  62.         if (pet2.readyState === 4){
  63.             //escribimos la respuesta
  64.             element2.innerHTML = pet2.responseText;
  65.         }
  66.     };
  67.    pet2.send(null);
  68.    
  69.    //******************************************************************************
  70.    //PARTE PARA LA LISTA DE RAMOS
  71.    //***************************************************************************
  72.     var element3 =  document.getElementById("div_ramox");
  73.     var fragment_url3 = "ListaRamos.jsp?id="+x+"&sw=0";
  74.     pet3.open("GET", fragment_url3);
  75.     pet3.onreadystatechange = function(){
  76.         if (pet3.readyState === 4){
  77.             //escribimos la respuesta
  78.             element3.innerHTML = pet3.responseText;
  79.         }
  80.     };
  81.    pet3.send(null);
  82.    //**************************************
  83.  
  84.    //******************************************************************************
  85.    //Si es SUCURSAL debe blanquear la lista de DIRECTORES
  86.    //***************************************************************************
  87.     var element4 =  document.getElementById("div_dirx");
  88.     var fragment_url4 = "ListaDirectoresBlank.jsp";
  89.     pet4.open("GET", fragment_url4);
  90.     pet4.onreadystatechange = function(){
  91.         if (pet4.readyState === 4){
  92.             //escribimos la respuesta
  93.             element4.innerHTML = pet4.responseText;
  94.         }
  95.     };
  96.    pet4.send(null);
  97.    //**************************************
  98. }
  #2 (permalink)  
Antiguo 06/06/2014, 09:02
 
Fecha de Ingreso: noviembre-2013
Mensajes: 147
Antigüedad: 10 años, 5 meses
Puntos: 1
Respuesta: no dispara funcion

Presento disculpas, era un error de principiante.

Para que no les pase a los novatos como yo.

El combo lo creo en la pagina inicial, pero despues lo lleno con otra JSP, y alli tenia especificada otra FUNCION.

No volvera a pasar.

Etiquetas: funcion, html, js, select, valor
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 20:55.