Código HTML:
<html> <head> <SCRIPT LANGUAGE=JavaScript> function Sumar() { var val1; var val2; var val3; val1 = (! parseFloat(document.factura.lista1.value))?0:parseFloat(document.factura.lista1.value); val1tot = val1 * document.factura.categoa.value; val2 = (! parseFloat(document.factura.lista2.value))?0:parseFloat(document.factura.lista2.value); val2tot = val2 * document.factura.categob.value; val3 = (! parseFloat(document.factura.lista3.value))?0:parseFloat(document.factura.lista3.value); val3tot = val3 * document.factura.categoc.value; document.factura.tot.value = val1tot+val2tot+val3tot; } </SCRIPT> </head> <body> <form name=factura> CATEGORIA A<br> <select name="lista1" onChange=Sumar()> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select name="lista1" onChange=Sumar()> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <BR><BR>CATEGORIA B<br> <select name="lista2" onChange=Sumar()> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <BR><BR>CATEGORIA C<br> <select name="lista3" onChange=Sumar()> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <br><br>TOTAL<br> <input name=tot size=6><br><br> Catego A <input name=categoa size=6 type='text' value="20"><br> Catego B <input name=categob size=6 type='text' value="50"><br> Catego C <input name=categoc size=6 type='text' value="100"></td> </form> </body> </html>
Gracias!!