";
text += "";
text += "Horsepower Results - 1/4 Mile Method";
text += "Your " +form.carModel.value;
text += " weighs about " +form.vehicleWeight.value+ " pounds ";
text += "and can complete a 1/4 mile in about ";
text += form.elapsedTime.value;
text += " seconds. That means that you've got about " +finalhp1;
text += " HP at the wheels, and about " + finalhp2;
text += " HP at the flywheel.";
text += "
";
resultsWindow=window.open("", "displayWindow", "toolbar=no,menubar=no,scrollbar=auto,resizable=no,width=320,height=180")
resultsWindow.document.writeln(text);
resultsWindow.document.close();
}
function input1(form)
{
Ctrl = form.carModel;
if (Ctrl.value == "")
{
validatePrompt (Ctrl, "Please Input a Car Model.")
return (false);
}
else
return (true);
}
function input2(form)
{
Ctrl = form.vehicleWeight;
if (Ctrl.value == "")
{
validatePrompt (Ctrl, "Please enter Your Vehicle Weight in Pounds.")
return (false);
}
else
return (true);
}
function input3(form)
{
Ctrl = form.elapsedTime;
if (Ctrl.value == "")
{
validatePrompt (Ctrl, "Please enter Your 1/4 mile trapspeed. You can estimate...")
return (false);
}
else
return (true);
}
function runSubmit (form, button)
{
if (!input1(form)) return;
if (!input2(form)) return;
if (!input3(form)) return;
create(form);
return;
}
function validatePrompt (Ctrl, PromptStr)
{
alert (PromptStr)
Ctrl.focus();
return;
}
function roundOff(value, precision)
{
value = "" + value;
precision = parseInt(precision);
var whole = "" + Math.round(value * Math.pow(10, precision));
var decPoint = whole.length - precision;
if(decPoint != 0)
{
result = whole.substring(0, decPoint);
result += ".";
result += whole.substring(decPoint, whole.length);
}
else
{
result = whole;
}
return result;
}
// End -->
Have you ever wondered how much horsepower your car makes at the wheels?
Well, now you can know for sure!
Thanks to Joel Lavarez for the code
Horsepower Calculator
This page has been visited
times.
|
Updated Feb 20, 1999