Metachecker.net
|
TrafficChecker.net
|
RankChecker.net
Learn Java Script Today
|
Over 5000 Free Fonts
|
Tutorials
|
Javascript Forum
|
Other Javascript Resources
|
Cheat Sheet
JavaScript Basics
Inserting Javascript
Complete Tutorial
Advance DHTML Tutorial
Script archive
Advanced Tutorials
Alert Scripts
Animation
Audio
Background Effects
Banner Ads
Browser Window
Buttons
Button Forms
Calculcators
Calendars
Clocks & Dates
Cookies
Cursor Effects
DHMTL Games
DHTML Miscellaneous
Equivalents
Forms
Games
IE4+ Scripts
IE5+ Scripts
Image Effects
Image Miscellaneous
Links & Buttons
Math Related
Messages Miscellaneous
Miscellaneous
Mouse Tricks
Navigation
Page Details
Password Protection
Pulldown Menus
Random Stuff
Scrolling
Status Bar
Text Animation
User Detail
User Info
Window Control
Horsepower Calculator
Enter your vehicle's quarter mile time (assuming you know it) and vehicle weight and this JavaScript program will display your car's estimated horsepower.
Horsepower Calculator
Car Model :
Vehicle Weight With Driver :
(in Pounds)
Quarter Mile time :
(in seconds)
Insert into <HEAD>
Insert into <BODY>
<SCRIPT LANGUAGE="JavaScript"> <!-- Original: Joel Lavarez --> <!-- Web Site: http://www.speed-online.com --> <!-- Begin var weight, eTime; var horsepower1, horsepower2, horsepower3, horsepower4; var temp1, temp2, temp3, temp4; var speed; var finalhp1, finalhp2, finalhp3, finalhp4, finalhp5, finalhp6; function create(){ eTime = document.getElementById("elapsedTime").value; weight = document.getElementById("vehicleWeight").value; temp1 = eTime / 5.825; temp1 = temp1 * temp1 * temp1; horsepower1 = weight / temp1; finalhp1 = roundOff(horsepower1, 2) horsepower2 = horsepower1 * 1.3; finalhp2 = roundOff(horsepower2, 2) text = '<head>\n'; text += '<meta name="title" content="JavaScript Made Easy: Free JavaScripts, Tutorials, Example Code, Reference, Resources, And Help">\n'; text += '<META NAME="description" CONTENT="Large Collection of JavaScript source code. Choose from thousands of free scripts. JavaScript tutorials with example code. Excellent reference material for JavaScript. If you need help with JavaScript. JavaScript Made Easy is the place to find it.">\n'; text += '<META NAME="keywords" CONTENT="javascript, jsmadeeasy, script, source code, code, source, online, internet, programing, DHMTL, Navigation, html, developer, develop, css, dhtml, netscape, www.javascript.com, javascript.com, Tutorials, Reference, Windows, Cookies">\n'; text += '<META NAME="keyphrase" CONTENT="javascript, jsmadeeasy, script, source code, code, source, online, internet, programing, DHMTL, Navigation, html, developer, develop, css, dhtml, netscape, www.javascript.com, javascript.com, Tutorials, Reference, Windows, Cookies">\n'; text += '<META NAME="generator" CONTENT="Microsoft FrontPage 4.0">\n'; text += '<META NAME="author" CONTENT="webmaster@jsmadeeasy.com">\n'; text += '<META NAME="robots" CONTENT="index,follow">\n'; text += '<META NAME="rating" CONTENT="General">\n'; text += '<META NAME="author" CONTENT="JSMadeEasy - CSIWorks">\n'; text += '<META NAME="revisit" CONTENT="30 days">\n'; text += '<META NAME="revisit-after" CONTENT="30 days">\n'; text += '<META NAME="distribution" CONTENT="global">\n'; text += '<META NAME="copyright" CONTENT="(C) Copyright 2006 ~ jsmadeeasy.com">\n'; text += '<META NAME="language" CONTENT="english">\n'; text += '<META NAME="theives" CONTENT="JavaScript Made Easy">\n'; text += '<META HTTP-EQUIV="expires" CONTENT="0">\n'; text += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n'; text += '<meta http-equiv="pics-label" content=\'(pics-1.1 "http://www.icra.org/ratingsv02.html" l gen true for "http://www.jsmadeeasy.com" r (cb 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.jsmadeeasy.com" r (n 0 s 0 v 0 l 0))\'>\n'; text += '<TITLE>1/4 Method</TITLE>'; text += "</HEAD><BODY BGCOLOR=#000000 TEXT=#FFFFFF>"; text += "<font face=arial size=-1><CENTER>"; text += "Horsepower Results - 1/4 Mile Method</CENTER><P>"; text += "Your " +document.getElementById("carModel").value; text += " weighs about " +document.getElementById("vehicleWeight").value+ " pounds "; text += "and can complete a 1/4 mile in about " text += document.getElementById("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.</font>"; text += "<center><form><input type=button onClick='self.close()' "; text += "value='Close Window'></form></center></font>"; 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() { Ctrl = document.getElementById("carModel"); if (Ctrl.value == "") { validatePrompt (Ctrl, "Please Input a Car Model.") return (false); } else return (true); } function input2() { Ctrl = document.getElementById("vehicleWeight"); if (Ctrl.value == "") { validatePrompt (Ctrl, "Please enter Your Vehicle Weight in Pounds.") return (false); } else return (true); } function input3() { Ctrl = document.getElementById("elapsedTime"); if (Ctrl.value == "") { validatePrompt (Ctrl, "Please enter Your 1/4 mile trapspeed. You can estimate...") return (false); } else return (true); } function runSubmit (button) { if (!input1()) return; if (!input2()) return; if (!input3()) return; create(); 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 --> </SCRIPT> <body> <center> <b>Horsepower Calculator</b> <form name="hp" method=get action=""> <center> <table border=0> <tr bgcolor="#909090"> <td align=right><font face="Arial, Helv"><b>Car Model : </b></font></td> <td><INPUT TYPE=text id="carModel" NAME="carModel" SIZE=20></td> <tr bgcolor="#909090"> <td align=right><font face="Arial, Helv"><b>Vehicle Weight With Driver : </b></font></td> <td><INPUT TYPE=text id="vehicleWeight" NAME="vehicleWeight" SIZE=10> (in Pounds)</td> <tr bgcolor="#909090"> <td align=right><font face="Arial, Helv"><b>Quarter Mile time : </b></font></td> <td><INPUT TYPE=text id="elapsedTime" NAME="elapsedTime" SIZE=10> (in seconds)</td> </table> <p> </font> <input type=button onClick="runSubmit()" name="HPcalc" value="Calculate Horsepower"> </form>
Other Options