Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/03/2013, 08:26
Avatar de miguec04
miguec04
 
Fecha de Ingreso: agosto-2008
Ubicación: Cimitarra, Santander
Mensajes: 378
Antigüedad: 15 años, 8 meses
Puntos: 15
Respuesta: No me funciona calculo de variables.

Si señor, yo pense que estaba trabajando con indices pero es que tenia mal los nombres, el codigo para que funcione correctamente es:

Código HTML:
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.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  4.     <title>
  5.         Documento sin título
  6.     </title>
  7.     function fncSumar(){
  8.         caja            = document.forms["frm"].elements;
  9.        
  10.         var numero1     = Number(caja['cantidad'].value);
  11.         var numero2     = Number(caja['pvp'].value);
  12.         total           = numero1*numero2;
  13.         if(!isNaN(total)) {
  14.             caja['total'].value = numero1*numero2;
  15.         }
  16.     }
  17.    
  18. </script>        
  19. </head>
  20. <body>      
  21.     <form method="post" name="frm" id="frm">
  22.         <table id="tabla">
  23.             <tr class="cab_factura">
  24.                 <td class="enlace10"></td>
  25.                 <td class="enlace10"></td>
  26.                 <td class="enlace10">Almacén</td>
  27.                 <td class="enlace10">Referencia</td>
  28.                 <td class="enlace10">Descripción</td>
  29.                 <td class="enlace10">Cantidad</td>
  30.                 <td class="enlace10">Precio</td>
  31.                 <td class="enlace10">%Dto.</td>
  32.                 <td class="enlace10">Total</td>
  33.                 <td class="enlace10"></td>
  34.             </tr>
  35.             <tr>
  36.                 <td>
  37.                     <input name="button" type=button onclick="agregar();" value="+"  />
  38.                 </td>
  39.                 <td>
  40.                     <input name="button" type=button onclick="borrarUltima();" value="-"/>
  41.                 </td>
  42.                 <td >
  43.                     <input name="almacen" type="text" size="5"  />
  44.                 </td>
  45.                 <td>
  46.                     <input name="recambio" id="recambio" type="text" size="10"/>
  47.                 </td>
  48.                 <td>
  49.                     <input name="denominacion" type="text" size="25"/>
  50.                 </td>
  51.                 <td>
  52.                     <input name="cantidad"type="text" size="5" onkeydown="fncSumar();"  onkeyup="fncSumar();"/>
  53.                 </td>
  54.                 <td>
  55.                     <input name="pvp" type="text" size="5"  onkeydown="fncSumar();"  onkeyup="fncSumar();"/>
  56.                 </td>
  57.                 <td>
  58.                     <input name="descuento" type="text" size="5"  />
  59.                 </td>
  60.                 <td>
  61.                     <input name="total" type="text" size="5" />
  62.                 </td>
  63.                 <td>
  64.                     <img src="imagenes_menu/untitled.png" width="20" height="20" style="cursor:pointer" />
  65.                 </td>
  66.             </tr>  
  67.         </table>
  68.     </form>
  69. </body>
  70. </html>
__________________
Desoftc Technology - Miguel Carmona
Creaciones Inteligentes - Cimitarra Colombia
[email protected]
http://www.desoftc.com.co