Foros del Web » Programando para Internet » Javascript »

suma ayuda por favor!

Estas en el tema de suma ayuda por favor! en el foro de Javascript en Foros del Web. Hola!! tengo la siguiente cuestion.. a ver si alguien me da una mano ya que me cuesta mucho esto.. tengo la pagina pedido.htm que tiene ...
  #1 (permalink)  
Antiguo 03/06/2010, 18:11
 
Fecha de Ingreso: septiembre-2009
Mensajes: 40
Antigüedad: 14 años, 8 meses
Puntos: 0
suma ayuda por favor!

Hola!!
tengo la siguiente cuestion.. a ver si alguien me da una mano ya que me cuesta mucho esto..
tengo la pagina pedido.htm que tiene el siguiente codigo en donde el cliente escoge el articulo le pone una cantidad, elige un talle y lo agrega:

Código Javascript:
Ver original
  1. <form NAME="itemsform" >
  2. <td width="45" valign="top"><p align="center>Art0766 </p>
  3. <td width="28" align="center" valign="top"><input TYPE= "value" NAME="agregar1" VALUE="1"  SIZE="3" > </td>
  4.    <td width="70" valign="top" align="center"><select size="1" name="newTalle" onChange="cambiarTalle()" id="talleSelect">
  5.          <option value="0">Talle</option>
  6.          <option value="26">T2</option>
  7.          <option value="26">T4</option>
  8.          <option value="27">T6</option>
  9.              </select>   
  10.       </td>
  11.    <td width="94" valign="top"><div align="center">
  12.        <input name="text2" type="text" style="border:0;" size="2" > $
  13.            <input name="text3" type="text" style="border:0;" size="2">
  14.               <input type="button" name="cbtadd2" value="Agregar"onClick="buyItem('Art0766',document.itemsform.newTalle.value,document.itemsform.agregar1.value,document.itemsform.text2.value)" >

una vez agregado tengo otra pagina (estado.htm) en donde me tira el detalle delo que el cliente escogio de la pagina pedido.htm con los siguientes items:

Producto / Talle / CAntidad / Costo x unidad / Costo total

yo lo que necesitaria hacer es que a medida que se vallan agregando las filas se me valla sumando la columna CANTIDAD para que el cliente valla viendo el numero de cosas que va agregando ya que el minimo es de 70

el codigo que tengo de la pagina estado.htm es el siguiente:

<html>
<head>
Código Javascript:
Ver original
  1. <SCRIPT LANGUAGE="JavaScript">
  2.    
  3.                
  4.         totprice = 0;
  5.         document.writeln('<form><table border="1" cellspacing="0" width="640" bgcolor="#E0E0E0" bordercolor="#FFFFFF" class="td">');
  6.        
  7.         document.writeln('<TR><TD width="150"><b>Producto</b></TD><TD width="50"><b>Talle</b></TD><TD width="80" align="right"><b>Cantidad</b></TD><TD width="120" align="right"><b>Costo x unidad</b></TD><td width="100" align="right"><b>Costo total</b><TD width="90">&nbsp;</TD></TR>');
  8.         itemlist = 0;
  9.         for (var i = 0; i <= fulllist.length; i++) {
  10.             if (fulllist.substring(i,i+1) == '[') {
  11.                 itemstart = i+1;
  12.             } else if (fulllist.substring(i,i+1) == ']') {
  13.                 itemend = i;
  14.                 thequantity = fulllist.substring(itemstart, itemend);
  15.                 itemtotal = 0;
  16.                 itemtotal = (eval(theprice*thequantity));
  17.                 temptotal = itemtotal * 100;
  18.                 var tax = itemtotal / 100 * (0 - 0);
  19.                     tax = Math.floor(tax * 100)/100
  20.                 totprice = totprice + itemtotal + tax;
  21.                 itemlist=itemlist+1;
  22.                
  23.                    
  24. document.writeln('<tr><td>'+talle+'</td><td>'+theitem+'</td><td align=right>'+thequantity+'</td><td align=right>'+theprice+'</td><td align=right>'+alterError(itemtotal)+'</td><td align=center><input TYPE="button" NAME="remove" VALUE="Quitar" onclick="javascript:removeItem('+itemlist+')"></td></tr>');
  25.            
  26.             } else if (fulllist.substring(i,i+1) == '/') {
  27.                 talle = fulllist.substring(itemstart, i);
  28.                 itemstart = i+1;
  29.                
  30.             } else if (fulllist.substring(i,i+1) == ',') {
  31.                 theitem = fulllist.substring(itemstart, i);
  32.                 itemstart = i+1;
  33.                
  34.                                                                
  35.             } else if (fulllist.substring(i,i+1) == '#') {
  36.                 theprice = fulllist.substring(itemstart, i);
  37.                 itemstart = i+1;
  38.            
  39.         }
  40.        
  41.     }
  42.  
  43.         document.writeln('<tr><td colspan=4><b>Total</b></td><td align=right>'+alterError(totprice)+'</td><td colspan=4><b>cantidad</b></td><td align=right>'+(resultado)+'</td><td>&nbsp;</td></tr>');
  44.         document.writeln('</TABLE>');
  45.     }
  46.  
  47.    
  48. </SCRIPT>
</table>
</center>
</body>
</html>

diculpen las molestia y si me peuden ayudar se los agradeceria mucho!

Etiquetas: favor, suma
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:39.