BEAUTIFUL RESPONSIVE WEB SITES

HTML + CSS + JAVASCRIPT


Simulador do Movimento Uniforme.

JAVASCRIPT


function gravar() {

var So = document.getElementById ("txtSo").value;
var v = document.getElementById ("txtVelocidade").value;
var tempo = document.getElementById ("txtTempo").value;
var Sfinal = ((parseFloat(So)) + ((parseFloat(v)) * (parseFloat (tempo))));
if(isNaN(Sfinal) || (tempo < 0)){
//o resultado não numero
alert('digite corretamente');
//sai da funcao
return;
}

$('#divResultado').css('background', '#000');
$('#divResultado').css('border', 'dashed 1px #fff');
$('#divResultado').css('width', '90%');
$('#divResultado').css('height', '180px');
$('#resp').show(1500); var div = document.getElementById("resp");
div.innerText = "S(t) = "+Sfinal+ " m"+"\n"+ " O espaço final percorrido foi de: " +Sfinal+ " metros";
}

function limpar() {

$('#divResultado').css('background', 'none');
$('#divResultado').css('border', 'none');
$('#divResultado').css('width', '0');
$('#divResultado').css('height', '0');
$('#resp').hide(1500);
}

JAVASCRIPT


function gravar02() {

var deltaS = document.getElementById ("txtVariacaoS").value;
var deltaT = document.getElementById ("txtVariacaoT").value;
var Vmedia = ((parseFloat(deltaS)) / (parseFloat (deltaT))).toFixed(2);
if(isNaN(Vmedia) || (deltaT < 0)){
//o resultado não numero
alert('digite corretamente');
//sai da funcao
return;
}

$('#divResultado-02').css('background', '#000');
$('#divResultado-02').css('border', 'dashed 1px #fff');
$('#divResultado-02').css('width', '90%');
$('#divResultado-02').css('height', '180px');
$('#resp-02').show(1500); var div = document.getElementById("resp-02");
div.innerText = "Vm = "+Vmedia+" m/s "+"\n"+ "A velocidade média foi de: "+Vmedia+" m/s";
}

function limpar02() {

$('#divResultado-02').css('background', 'none');
$('#divResultado-02').css('border', 'none');
$('#divResultado-02').css('width', '0');
$('#divResultado-02').css('height', '0');
$('#resp-02').hide(1500);
}

JAVASCRIPT


function gravar03() {

var Sinicial = document.getElementById( "txtSinicial").value;
var Vel = document.getElementById( "txtVel").value;
var Temp = document.getElementById( "txtTemp").value;
var Sfinal = ((parseFloat(Sinicial)) + ((parseFloat(Vel)) * ((parseFloat(Temp))))).toFixed(2);
if(isNaN(Sfinal) || (Temp < 0)){
//o resultado não numero
alert('digite corretamente');
//sai da funcao
return;
}

$('#divResultado-03').css('background', '#000');
$('#divResultado-03').css('border', 'dashed 1px #fff');
$('#divResultado-03').css('width', '90%');
$('#divResultado-03').css('height', '70px');
$('#resp-03').show(1500);

var div = document.getElementById( "resp-03");
div.innerText = "O espaço final é igual a: "+Sfinal+ " metros";
x = (Temp*1)+40;
y = (-1*(Sinicial - 150));
z = (-1*(Sfinal-150));

var c = document.getElementById( "myCanvas");
var ctx = c.getContext( "2d");

ctx.beginPath();
ctx.moveTo(40,y);
ctx.lineTo(x, z);
ctx.stroke();

ctx.beginPath();
ctx.moveTo(40,170);
ctx.lineTo(40,0);
ctx.stroke();

ctx.beginPath();
ctx.moveTo(0,150);
ctx.lineTo(340,150);
ctx.stroke();

ctx.beginPath();
ctx.fillStyle = "black";
ctx.strokeStyle = "black";
ctx.font = "10pt sans-serif";
ctx.fillText("S (metros)",50,16);
ctx.fillText("t (segundos)",270,140);
ctx.fillText("300",310,165);
ctx.fillText("150",10,16);
ctx.fillText("150",155,165);
ctx.fillText("75",10,82);
ctx.fill();
ctx.stroke();

}

function limpar03() {

$('#divResultado-03').css( 'background', 'none');
$('#divResultado-03').css ('border', 'none');
$('#divResultado-03').css ('width', '0');
$('#divResultado-03').css ('height', '0');
$('#resp-03').hide(1500);
}