antiblock
Rodnia | Alpha & Omega
  • Chatbox

    You don't have permission to chat.
    Load More
Sign in to follow this  
miguelt1

[Ajuda]

4 posts in this topic

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>
<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
antiblock
Rodnia | Alpha & Omega

 

 

<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

Share this post


Link to post
Share on other sites

Obrigado, foi exatamente isso que aconteceu, esqueci-me completamente do = ...

Share this post


Link to post
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this