Cálculo da velocidade média
HTML
<body>
<form id="formulario">
<fieldset>
<legend>Cálculo da velocidade</legend>
<label for="espaço">espaço:</label>
<input type="text" name="espaço"/>
<label for="tempo">tempo:</label>
<input type="text" name="tempo"/>
<label for="velocidademedia">velocidade média:</label>
<input type="text" name="velocidademedia" disabled="disabled"/>
<a href="#" onclick="calcularvelocidade()">Calcular</a>
</fieldset>
</form>
</body>
CSS
img, table { width:165px; }
fieldset { width:140px; }
label { display:block; float:left;}
label, input {width:68px; margin:3px 0; }
th, td {border:1px solid #ccc; font-size:0.8em;}
JAVASCRIPT
calcularvelocidade = function(){
var formulario = document.getElementById("formulario");
var espaço = +formulario.espaço.value;
var tempo = +formulario.tempo.value;
var velocidademedia= espaço/tempo
formulario.velocidademedia.value = velocidademedia.toFixed(2);
}