Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/04/2009, 12:09
Avatar de ugmaster
ugmaster
 
Fecha de Ingreso: abril-2008
Ubicación: Veracruz, México
Mensajes: 73
Antigüedad: 16 años, 10 meses
Puntos: 1
Respuesta: persistencia de referencia a objetos, en handler de eventos

El codigo del handler apply
Código:
/**/
function click_apply(target)
    {
        if(document.getElementById('proveedor').selectedIndex>0)
            {
                if (trim(document.getElementById('cantidad').value).length>0)
                    {
                        if (trim(document.getElementById('costo_unidad_compra').value).length>0 && document.getElementById('costo_unidad_compra').value>0)
                            {
                                clear_Node(target.parentNode.parentNode.childNode[3]);
                                target.parentNode.parentNode.childNode[3].appendChild(document.createTextNode(target.parentNode.parentNode.childNode[0].nodeValue*document.getElementById('cantidad').value));
                                clear_Node(target.parentNode.parentNode.childNode[4]);
                                target.parentNode.parentNode.childNode[4].appendChild(document.createTextNode(document.getElementById('cantidad').value));
                                clear_Node(target.parentNode.parentNode.childNode[5]);
                                target.parentNode.parentNode.childNode[5].appendChild(document.createTextNode(document.getElementById('costo_unidad_compra').value));
                                clear_Node(target.parentNode.parentNode.childNode[6]);
                                target.parentNode.parentNode.childNode[6].appendChild(document.createTextNode(document.getElementById('proveedor').options[document.getElementById('proveedor').selectedIndex].text+';'+document.getElementById('esquemas_descuentos').options[document.getElementById('esquemas_descuentos').selectedIndex].value));

                                document.forms[0].removeChild(document.getElementById('div_oscuro'));
                                document.forms[0].removeChild(document.getElementById('div_nuevo_registro'));                
                            }
                        else{
                                alert('El costo no puede ser 0.00');
                                document.getElementById('costo_unidad_compra').value='0.00';
                                document.getElementById('costo_unidad_comopra').focu();
                            }
                    }
                else{
                        alert('Especifique una cantidad');
                        document.getElementById('cantidad').value='';
                        document.getElementById('cantidad').focu();
                    }
            }
        else{
                alert('Debe Seleccionar un proveedor');
                document.getElementById('proveedor').focus();
            }
    }
En un solo post no me cupo jejje perdon, espero puedan ayudarme con esto
__________________
"Lo que aun no existe... es porque el ser humano aún no lo ah imaginado..."