Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/12/2015, 06:29
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 9 años, 7 meses
Puntos: 263
Respuesta: Input enviar con obligación de campos

eso es un bucle y no se porque lo tienes alli, pero prueba asi:

Código HTML:
Ver original
  1. <p>
  2. Utilidad Neta ($):
  3. <input type="number" id="D5" style="background-color: border:1px; text-align: center;">
  4. </p>
  5. <p>
  6. Capital ($):
  7. <input type="number" id="D6" style="background-color: border:1px; text-align: center;">
  8. </p>
  9. <p>
  10. Extrautilidad ($):
  11. <input type="number" id="D7" style="background-color: border:1px; text-align: center;">
  12. </p>
  13. <p>
  14. <input type="button" onClick="calcule();" value="Resultado" style="background-color: border:1px; text-align: center;">
  15. </p>
  16. <div id="resultado"></div>
  17. </form>

Código Javascript:
Ver original
  1. function calcule(){
  2. var A = document.getElementById('D5').value;
  3.   var B = document.getElementById('D6').value;
  4.   var C = document.getElementById('D7').value;
  5.  
  6.   var D = document.getElementById('resultado');
  7.  
  8.   D.innerHTML = ((parseFloat(A)/parseFloat(B))*100)+parseFloat(C);
  9.  
  10. }

Aquí una muestra: https://codepen.io/anon/pen/LGpqpJ
__________________
[email protected]
HITCEL