Movimento Retilineo Uniforme

HTML
<body> <form id="formulario"> <fieldset> <legend> movimento retineo uniforme</legend> <label for="espaco0">espaco0:</label> <input type="text" name="espaco0"/> <label for="velocidade">velocidade:</label> <input type="text" name="velocidade"/> <label for="tempo">tempo:</label> <input type="text" name="tempo"/> <label for="espacofinal">espaco final:</label> <input type="text" name="espacofinal" disabled="disabled"/> <a href="#" onclick="calcularespacofinal()">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
calcularespacofinal = function(){ var formulario = document.getElementById("formulario"); var espaco0 = +formulario.espaco0.value; var velocidade = +formulario.velocidade.value; var tempo = +formulario.tempo.value; var espacofinal = espaco0+(velocidade*tempo); formulario.espacofinal.value = espacofinal.toFixed(2); }
Expand for more options Login