Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/07/2010, 15:31
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 1 mes
Puntos: 126
Respuesta: JavaScript y PHP

Hola

Pongamos por caso que tu HTML es algo como esto
Código HTML:
Ver original
  1. <input type="text" id="camp_1_precio" name="precio" value="100" />
  2. <input type="text" id="camp_1" name="cantidad" value="" onkeypress="funcion(this.id, this.value);" />
  3. <div id="camp_1_total"></div>
  4.  
  5. <input type="text" id="camp_2_precio" name="precio" value="100" />
  6. <input type="text" id="camp_2" name="cantidad" value="" onkeypress="funcion(this.id, this.value);" />
  7. <div id="camp_2_total"></div>

El javascript
Código Javascript:
Ver original
  1. function funcion(id, val) {
  2. document.getElementById(id+'_total').innerHTML = document.getElementById(id+'_precio').value * val;
  3. }

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />