miguelt1 3 Posted May 8, 2014 Boas pessoal é assim eu estou a fazer uma calculadora de imc para website utilizando html,css e javascript mas não está funcionando quando carrego no botão carregar alguem me ajuda? O codigo html é: <!DOCTYPE html> <html> <head> <link rel='stylesheet' href='style.css'/> <script src='script.js'></script> </head> <body> <img src="http://static.hsw.com.br/gif/bmi-comparison.gif"/> <form id="formulario"> <fieldset> <legend> Cálculo do IMC</legend> <label for="kilo">Kilos:</label> <input type="text" name="kilo"/> <label for="metros">Metros:</label> <input type="text" name"metros"/> <label for="centimetros">Cm:</label> <input type="text" name"centimetros"/> <label for="imc">IMC:</label> <input text="text" name="imc" disabled="disabled" /> <a href="#" onclick="calcularIMC();">Calcular</a> </fieldset> </form> <table> <tr><th>IMC</th><th>Classificação</th></tr> <tr><td><20</td><td>Abaixo do Peso</td></tr> <tr><td>20 a 25</td><td>Peso ideal</td></tr> <tr><td>30 a 35</td><td>Obesidade Moderada</td></tr> </table> </body> </html> o codigo css: img.table{ width:165px;} fieldset { width:140px;} label { display:block; ; float:left;} label, input { width:68px; margin: 3px 0;} th,ted { border:1px solid #ccc; font-size:0 8em;} o codigo javascript: function calcularIMC () { var formulario= document.getElementById("formulario"); var kilo= + formulario.kilo.value; var metros= + formulario.metros.value; var centimetros= + formulario.centimetros.value; var altura=(metros*100 + centimetros)/100; var imc= kilo/(altura*altura); formulario.imc.value = imc.toFixed(2); } Share this post Link to post Share on other sites
XtreamRules 71 Posted May 8, 2014 <input type="text" name"metros"/> <input type="text" name"centimetros"/> Provavelmente pode não ter nada haver mas nao era suposto depois de name ter = ? eu nao presebo nada disto mas as veezes quando vou editar sites esqeço-me de alguns caracteres e isso fod tudo xD 1 miguelt1 reacted to this Share this post Link to post Share on other sites
miguelt1 3 Posted May 9, 2014 Obrigado, foi exatamente isso que aconteceu, esqueci-me completamente do = ... Share this post Link to post Share on other sites
XtreamRules 71 Posted May 9, 2014 Obrigado, foi exatamente isso que aconteceu, esqueci-me completamente do = ... A Serio? :DD Sinto-me Feliz por ter ajudado :) Share this post Link to post Share on other sites