Ver Mensaje Individual
  #6 (permalink)  
Antiguo 13/11/2008, 12:42
vmac179
 
Fecha de Ingreso: julio-2007
Ubicación: /home/victor
Mensajes: 114
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Rescatar Valor

bueno ya lo arregle se los dejo

Código PHP:
function agregar_fila(origen,destino) {
    
///////////////////////////////////////////

    
var region   origen.regiones.value;
    var 
territorio origen.territorio.value;
    var 
provincia origen.provincia.value;
    var 
comuna origen.comuna.value;
    var 
localidad origen.value;
    
    var 
nuevo_indice destino.rows.length;

    var 
fila;
    var 
celda;
    var 
valor;
    
    
fila destino.insertRow(nuevo_indice);
    
fila.style.background "white";
    
    
///////////////////////////////////////////

    
celda fila.insertCell(0);
    
valor document.createElement("input");
        
valor.type "checkbox";
        
valor.id "marca";
        
valor.name "marca";
        
valor.value nuevo_indice;
    
celda.appendChild(valor);

    
///////////////////////////////////////////

    
celda fila.insertCell(1);
    var 
region document.createElement('input'
        
region.type 'hidden'

    
var region_id document.getElementById('regiones');
        var 
txtTextObj document.getElementById('txtText');
        
    var 
selIndex region_id.selectedIndex;
        
region.value region_id.options[selIndex].text;    

    
valor document.createTextNode(region.value);
    
celda.appendChild(valor);
    
    
///////////////////////////////////////////

    
celda fila.insertCell(2);
    var 
territorio document.createElement('input'
        
territorio.type 'hidden'

    
var territorio_id document.getElementById('territorio');
        var 
txtTextObj document.getElementById('txtText');

    var 
selIndex territorio_id.selectedIndex;
        
territorio.value territorio_id.options[selIndex].text;    

    
valor document.createTextNode(territorio.value);
    
celda.appendChild(valor);
    
    
///////////////////////////////////////////

    
celda fila.insertCell(3);
    var 
provincia document.createElement('input'
        
provincia.type 'hidden'

    
var provincia_id document.getElementById('provincia');
        var 
txtTextObj document.getElementById('txtText');

    var 
selIndex provincia_id.selectedIndex;
        
provincia.value provincia_id.options[selIndex].text;    

    
valor document.createTextNode(provincia.value);
    
celda.appendChild(valor);
    
    
///////////////////////////////////////////

    
celda fila.insertCell(4);
    var 
comuna document.createElement('input'
        
comuna.type 'hidden'

    
var comuna_id document.getElementById('comuna');
        var 
txtTextObj document.getElementById('txtText');

        
    var 
selIndex comuna_id.selectedIndex;
        
comuna.value comuna_id.options[selIndex].text;    

    
valor document.createTextNode(comuna.value);
    
celda.appendChild(valor);
    
    
///////////////////////////////////////////

    
celda fila.insertCell(5);
    var 
localidad document.createElement('input'
        
localidad.type 'hidden'
        
localidad.name 'localidad[]'

    
var localidad_id document.getElementById('localidad');
        var 
txtTextObj document.getElementById('txtText');
        
    var 
selIndex localidad_id.selectedIndex;
        
localidad.value localidad_id.options[selIndex].text;    

    
valor document.createTextNode(localidad.value);
    
celda.appendChild(valor);
    
    
///////////////////////////////////////////

    
celda fila.insertCell(6);
    var 
latitud document.createElement('input'// latitud
        
latitud.type 'text'
        
latitud.name 'latitud[]'
        
        
celda.appendChild(latitud);

    
///////////////////////////////////////////

    
celda fila.insertCell(7);
    var 
longitud document.createElement('input'// longitud
        
longitud.type 'text'
        
longitud.name 'longitud[]'
        
        
celda.appendChild(longitud);

    
///////////////////////////////////////////
    
    
celda fila.insertCell(8);
    var 
monto document.createElement('input'// montos
        
monto.type 'text'
        
monto.name 'montos[]'
        
        
celda.appendChild(monto);

    
///////////////////////////////////////////

    
var    region document.createElement('input'// territorio
        
region.type 'hidden'
        
region.name 'regiones[]'

    
var region_id document.getElementById('regiones');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex region_id.selectedIndex;
        
region.value region_id.options[selIndex].id;

        
region.innerHTML=region;
        
celda.appendChild(region);            

    
///////////////////////////////////////////

    
var    territorio document.createElement('input'// territorio
        
territorio.type 'hidden'
        
territorio.name 'territorios[]'

    
var territorio_id document.getElementById('territorio');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex territorio_id.selectedIndex;
        
territorio.value territorio_id.options[selIndex].id;

        
territorio.innerHTML=territorio;
        
celda.appendChild(territorio);            

    
///////////////////////////////////////////

    
var    provincia document.createElement('input'// territorio
        
provincia.type 'hidden'
        
provincia.name 'provincias[]'

    
var provincia_id document.getElementById('provincia');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex provincia_id.selectedIndex;
        
provincia.value provincia_id.options[selIndex].id;

        
provincia.innerHTML=provincia;
        
celda.appendChild(provincia);            

    
///////////////////////////////////////////

    
var    comuna document.createElement('input'// territorio
        
comuna.type 'hidden'
        
comuna.name 'comunas[]'

    
var comuna_id document.getElementById('comuna');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex comuna_id.selectedIndex;
        
comuna.value comuna_id.options[selIndex].id;

        
comuna.innerHTML=comuna;
        
celda.appendChild(comuna);            

    
///////////////////////////////////////////

    
var    localidad document.createElement('input'// territorio
        
localidad.type 'hidden'
        
localidad.name 'localidades[]'

    
var localidad_id document.getElementById('localidad');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex localidad_id.selectedIndex;
        
localidad.value localidad_id.options[selIndex].id;

        
localidad.innerHTML=localidad;
        
celda.appendChild(localidad);            
        
    
///////////////////////////////////////////    

}

function 
remover_filas_marcadas(origen) {
    
///////////////////////////////////////////

    
var inputs origen.getElementsByTagName("input");
    var 
checkboxes = new Array();
    var 
chk_cuenta 0;
    
    
///////////////////////////////////////////

    
for (i=0i<inputs.lengthi++)
    {
        if (
inputs[i].type == "checkbox" &&
            
inputs[i].id == "marca" &&
            
inputs[i].checked)
        {
            
checkboxes[chk_cuenta] = inputs[i];
            
chk_cuenta ++;
        }
    }

    
///////////////////////////////////////////

    
for (i=0i<checkboxes.lengthi++)
    {
        
origen.deleteRow(checkboxes[i].value 1*i);
    }    

    
///////////////////////////////////////////
    
    
corregir_indices_tabla(origen);

    
///////////////////////////////////////////
}

function 
corregir_indices_tabla(origen) {
    
///////////////////////////////////////////

    
var inputs origen.getElementsByTagName("input");
    
    
///////////////////////////////////////////

    
for (i=0i<inputs.lengthi++)
    {
        if (
inputs[i].type == "checkbox" &&
            
inputs[i].id == "marca")
        {
            
inputs[i].value 1;
        }
    }

    
///////////////////////////////////////////