frank_010 Posted May 12, 2010 Report Share Posted May 12, 2010 alguien que me diga este codigo xfa... gracias (Y) Link to comment Share on other sites More sharing options...
alvaroxz Posted May 13, 2010 Report Share Posted May 13, 2010 (edited) alguien que me diga este codigo xfa... gracias (Y) esto no es pedido de scripts. lee bien de que trata cada rincon antes de postiar, pide que lo cambien de lugar de todos modos te dejo una manera que en que podrias obtener el IMC por javascript <html> <head> <title>Cacluladora de IMC</title> <script LANGUAGE="JavaScript"> function checkIt(evt) { evt = (evt) ? evt : window.event var charCode = (evt.which) ? evt.which : evt.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) { status = "This field accepts numbers only." return false } status = "" return true } function calc() { var masa1 = document.getElementById('masa').value; var altura1 = document.getElementById('high').value; masa = parseFloat(masa1); altura = parseFloat(altura1)/100; if(altura == 0) { document.getElementById('imc').value='N/A'; } else { imc = masa/(altura*altura); document.getElementById('imc').value=imc; } } </SCRIPT> </head> <body> <table> <tr> <td>Masa en kilos:</td> <td><input type="text" id="masa" size="3" maxlength="3" onkeypress="return checkIt(event); calc();" /></td> </tr> <tr> <td>Estatura en centimetros:</td> <td><input type="text" id="high" size="3" maxlength="3" onkeypress="return checkIt(event); calc();" /></td> </tr> <tr> <td>IMC</td> <td><input type="text" id="imc" disabled="true" size="3" /></td> </tr> <tr> <td colspan="2"><input type="button" onclick="calc();" value="Calcular"/></td> </tr> </table> </body> </html> Edited May 13, 2010 by alvaroxz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now