Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/02/2013, 09:30
faseb
 
Fecha de Ingreso: septiembre-2012
Ubicación: posadas
Mensajes: 53
Antigüedad: 12 años, 5 meses
Puntos: 0
Respuesta: valor NaN devuelto por js

este es el script el cual multiplica

<script>
function calcula(operacion){
var cantidad = document.getElementById('CANTIDAD').value;
var precio = document.getElementById('PRECIO').innerHTML;
var decimal = parseFloat('precio');
var subtotal = cantidad * decimal
document.getElementById('SUBTOTAL').value = subtotal
}

</script>


ak la parte q envia al script

<td><div id="PRECIO" onKeyPress="calcula(this.value);"></div></td>// ak recibo el valor desde ajax
<td>&nbsp;</td>
<td><input type="text" name="CANTIDAD" id="CANTIDAD" value="" onChange="calcula()"></td>
<td>&nbsp;</td>
<td><input type="number" name="SUBTOTAL" id="SUBTOTAL" value=""></td>

si necesitas algo mas pedime. los valores q tengo son 4.00 , 5.99 , 10.50