Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
expression to add values from a column

The next expression (marked between ****) is part of code of a web site that offers a list of PC components and lets you choose the parts to create you own PC.. the thing is, I need to collect each selected item but it´s not working.. I´m pretty new at this AND don´t worry it´s not a real page.. it´s an exercise but I really want to understand where is my problem.

    let TotalsinIva = 0;
    let TotalFinal = 0;
    let iva = 0;
    
********************************    
    function sumafactura() {
        TotalSI = 0;
        let productos = document.getElementsByTagName("select");
        for (let i = 0; i < productos.length; i++) {
            TotalSI += eval(productos[i].value);
        }
********************************    
        document.getElementById("Total").value = TotalSI.toFixed(2) + " €.";
        iva = (TotalSI * 18 / 100);
        document.getElementById("Iva").value = iva.toFixed(2) + " €.";
        TotalFinal = TotalSI + iva;
        document.getElementById("TotalTotal").value = TotalFinal.toFixed(2) + " €.";
    }
    
    function imprimir(){
        text = ("<HEAD><TITLE>Factura de tu ordenador</TITLE></HEAD>");
        text += "<BODY BGCOLOR='#FFFFFF'><B><FONT SIZE= 4 COLOR=BLUE>Factura desglosada de tu pedido.</FONT></B>";
        text += "<br><hr>";
        text += "<TABLE BORDER =0><TR VALIGN=Top><TD VALIGN=Top>";
        text += "<B>Caja de Ordenador:<BR>Disco Duro: <BR>Teclado: <BR>Ratones: <BR>Placa base: <BR>Tarjetas de sonido:";
        text += "<BR>Microprocesadores: <BR>Monitores: <BR>Tarjeta gráfica: <BR>Routers: <BR>Granadoras: <BR>Impresoras: ";
        text += "</B></TD><TD>";
    
        let productos = document.getElementsByTagName("select");
        for (let i = 0; i < productos.length; i++) {
            text += "<b>" + productos[i].value + " €." + "<br>";
        }
        text = (text + "<br><br><CENTER><BUTTON onClick='window.print()'><img SRC='Imagenes/impre.gif' border='0' WIDTH='38' HEIGHT='34'></BUTTON>");
        text = (text + "</body></html>");
        msgWindow = window.open("", "displayWindow", "toolbar=no,width=375,height=480,directories=no,status=yes,scrollbars=no,resize=no,menubar=yes");
        msgWindow.document.write(text);
        msgWindow.document.close();
    }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda