Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/03/2013, 06:33
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
No me funciona calculo de variables.

Hola, por favor podeis decirme porque no me funciona este código?

Código Javascript:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Documento sin título</title>
  6. <script>
  7. function fncSumar(){
  8. caja=document.forms["frm"].elements;
  9. var numero1 = Number(caja[cantidad].value);
  10. var numero2 = Number(caja[pvp].value);
  11. total=numero1*numero2;
  12. if(!isNaN(total)){
  13.     caja[total].value=numero1*numero2;
  14. }
  15. }
  16. </script>        
  17. </head>
  18. <body>      
  19. <table id="tabla">
  20. <form method="post" name="frm" id="frm">
  21. <tr class="cab_factura">
  22.      <td class="enlace10"></td>
  23.     <td class="enlace10"></td>
  24.     <td class="enlace10">Almacén</td>
  25.     <td class="enlace10">Referencia</td>
  26.     <td class="enlace10">Descripción</td>
  27.     <td class="enlace10">Cantidad</td>
  28.     <td class="enlace10">Precio</td>
  29.     <td class="enlace10">%Dto.</td>
  30.     <td class="enlace10">Total</td>
  31.     <td class="enlace10"></td>
  32.   </tr>
  33.  
  34. <tr>
  35.    <td><input name="button" type=button onclick="agregar();" value="+"  /></td>
  36.    <td><input name="button" type=button onclick="borrarUltima();" value="-"/></td>
  37.     <td ><input name="almacen" type="text" size="5"  /></td>
  38.     <td><input name="recambio" id="recambio" type="text" size="10"/></td>
  39.     <td><input name="denominacion" type="text" size="25"/></td>
  40.     <td><input name="cantidad"type="text" size="5" onkeyup="fncSumar();"  /></td>
  41.     <td><input name="pvp" type="text" size="5"  /></td>
  42.     <td><input name="descuento" type="text" size="5"  /></td>
  43.     <td><input name="total" type="text" size="5" /></td>
  44.     <td><img src="imagenes_menu/untitled.png" width="20" height="20" style="cursor:pointer" /></td>
  45.   </tr>  
  46. </table>
  47. </form>
  48. </body>
  49. </html>

Gracias