Usefull Scripts
Monday, October 26, 2009
make a Atmosphere calculator
Copy and paste this code where u want..
<br><!-- this script got from <br>http://usefull-script.blogspot.com/Coded by: Ratnakar Mishra --><br><br><br><br><br><!-- TWO STEPS TO INSTALL ATMOSPHERE CALCULATOR:<br><br> 1. Paste the specified coding into the HEAD of the HTML document<br> 2. Put the last code into the BODY of your HTML document --><br><br><!-- STEP ONE: Copy this code into the HEAD your HTML document --><br> <br><HEAD><br><br><SCRIPT LANGUAGE="JavaScript"><br><br><br><! ><br><! ><br><br><!-- Begin<br>function setEUnits() {<br>var str = document.forms[1].hunits.value;<br>if ( str== "ft") {<br>alert("Already in English Units.");<br>return;<br>}<br>document.forms[1].hunits.value = "ft"<br>document.forms[1].vunits.value = "ft/sec"<br>document.forms[1].lunits.value = "ft"<br>document.forms[2].tunits.value = "deg R"<br>document.forms[2].runits.value = "sl/ft^3"<br>document.forms[2].punits.value = "lb/ft^2"<br>document.forms[2].sunits.value = "ft/sec"<br>document.forms[2].muunits.value = "lb sec/ft^2"<br>document.forms[2].qunits.value = "lb/ft^2"<br>var h = document.forms[1].alt.value;<br>var v =document.forms[1].speed.value;<br>var rl = document.forms[1].rlength.value;<br>var tempVal = document.forms[2].temp.value <br>var rhoVal = document.forms[2].rho.value <br>var pVal = document.forms[2].press.value <br>var soundVal = document.forms[2].ssound.value <br>var viscVal = document.forms[2].visc.value <br>var machVal = document.forms[2].mach.value <br>var qVal =document.forms[2].q.value <br>var cpstarVal = document.forms[2].cpstar.value <br>var cpminVal = document.forms[2].cpmin.value<br>var reynolds = document.forms[2].reno.value<br>var cflam = document.forms[2].cfl.value<br>var cfturb = document.forms[2].cft.value<br>document.forms[1].alt.value = h*3.2808<br>document.forms[1].speed.value = v*3.2808<br>document.forms[1].rlength.value = rl*3.2808<br>document.forms[2].temp.value =tempVal*1.8<br>document.forms[2].rho.value = rhoVal * .068521 * .028317<br>document.forms[2].press.value = pVal * .020885<br>document.forms[2].ssound.value = soundVal*3.2808<br>document.forms[2].visc.value = viscVal*.22481*.092903<br>document.forms[2].mach.value = machVal<br>document.forms[2].q.value = qVal * .020885<br>document.forms[2].cpstar.value = cpstarVal<br>document.forms[2].cpmin.value = cpminVal<br>document.forms[2].reno.value = reynolds<br>document.forms[2].cfl.value = cflam<br>document.forms[2].cft.value = cfturb<br>roundAll();<br>}<br>function setMUnits() {<br>var str = document.forms[1].hunits.value;<br>if ( str== "m") {<br>alert("Already in metric units.");<br>return;<br>}<br>Compute();<br>document.forms[1].hunits.value = "m"<br>document.forms[1].vunits.value = "m/sec"<br>document.forms[1].lunits.value = "m"<br>document.forms[2].tunits.value = "deg K"<br>document.forms[2].runits.value = "kg/m^3"<br>document.forms[2].punits.value = "N/m^2"<br>document.forms[2].sunits.value = "m/sec"<br>document.forms[2].muunits.value = "N sec/m^2"<br>document.forms[2].qunits.value = "N/m^2"<br>var h = document.forms[1].alt.value;<br>var v = document.forms[1].speed.value;<br>var rl = document.forms[1].rlength.value;<br>var tempVal = document.forms[2].temp.value <br>var rhoVal = document.forms[2].rho.value <br>var pVal = document.forms[2].press.value <br>var soundVal = document.forms[2].ssound.value <br>var viscVal = document.forms[2].visc.value <br>var machVal = document.forms[2].mach.value <br>var qVal =document.forms[2].q.value <br>var cpstarVal = document.forms[2].cpstar.value <br>var cpminVal = document.forms[2].cpmin.value<br>var reynolds = document.forms[2].reno.value<br>var cflam = document.forms[2].cfl.value<br>var cfturb = document.forms[2].cft.value<br>document.forms[1].alt.value = h/3.2808<br>document.forms[1].speed.value = v/3.2808<br>document.forms[1].rlength.value = rl/3.2808<br>document.forms[2].temp.value =tempVal/1.8<br>document.forms[2].rho.value = rhoVal / .068521 / .028317<br>document.forms[2].press.value = pVal / .020885<br>document.forms[2].ssound.value = soundVal/3.2808<br>document.forms[2].visc.value = viscVal/.22481/.092903<br>document.forms[2].mach.value = machVal<br>document.forms[2].q.value = qVal / .020885<br>document.forms[2].cpstar.value = cpstarVal<br>document.forms[2].cpmin.value = cpminVal<br>document.forms[2].reno.value = reynolds<br>document.forms[2].cfl.value = cflam<br>document.forms[2].cft.value = cfturb<br>roundAll();<br>}<br>function ResetForm() {<br>document.forms[1].alt.value = "0.0"<br>document.forms[1].speed.value = "1.0"<br>document.forms[1].rlength.value = "1.0"<br>}<br>function Compute() {<br>// First set to English Units<br>var origUnits = "english";<br>var str = document.forms[1].hunits.value;<br>if ( str== "m") {<br>origUnits = "metric";<br>setEUnits();<br>}<br>var h = document.forms[1].alt.value;<br>var v =document.forms[1].speed.value;<br>var rl = document.forms[1].rlength.value;<br>var TEMPSL = 518.67;<br>var RHOSL = 0.00237689;<br>var PRESSSL = 2116.22;<br>var saTheta = 1.0<br>var saSigma = 1.0<br>var saDelta = 1.0<br>if ( h<232940 ){<br>saTheta = 1.434843 - h/337634;<br>saSigma = Math.pow( 0.79899-h/606330, 11.20114 );<br>saDelta = Math.pow( 0.838263-h/577922, 12.20114 );<br>}<br>if ( h<167323 ){<br>saTheta = 0.939268;<br>saSigma = 0.00116533 * Math.exp( (h-154200)/-25992 );<br>saDelta = 0.00109456 * Math.exp( (h-154200)/-25992 );<br>}<br>if ( h<154199 ){<br>saTheta = 0.482561 + h/337634;<br>saSigma = Math.pow( 0.857003+h/190115, -13.20114 );<br>saDelta = Math.pow( 0.898309+h/181373, -12.20114 );<br>}<br>if ( h<104987 ){<br>saTheta = 0.682457 + h/945374;<br>saSigma = Math.pow( 0.978261+h/659515, -35.16319 );<br>saDelta = Math.pow( 0.988626+h/652600, -34.16319 );<br>}<br>if ( h<65617 ){<br>saTheta = 0.751865;<br>saSigma = 0.297076 * Math.exp( (36089-h)/20806 );<br>saDelta = 0.223361 * Math.exp( (36089-h)/20806 );<br>}<br>if ( h<36089 ){<br>saTheta = 1.0 - h/145442;<br>saSigma = Math.pow( 1.0-h/145442, 4.255876 );<br>saDelta = Math.pow( 1.0-h/145442, 5.255876 );<br>}<br>var tempVal = TEMPSL * saTheta;<br>var rhoVal = RHOSL * saSigma;<br>var pVal = PRESSSL * saDelta;<br>var viscVal = 0.0226968*Math.pow( tempVal, 1.5 ) / ((tempVal)+198.72) / 1000000.0;<br>var soundVal = Math.sqrt( 1.4*1716.56*(tempVal) );<br>var machVal = v/soundVal<br>var qVal = 0.7*pVal*machVal*machVal<br>var reynolds = v*rl*rhoVal/viscVal<br>var cfturb = 0.455/Math.pow((Math.log(reynolds)/Math.log(10)),2.58)<br>var cflam = 1.328/Math.sqrt(reynolds)<br>document.forms[2].temp.value = tempVal<br>document.forms[2].rho.value = rhoVal<br>document.forms[2].press.value = pVal<br>document.forms[2].ssound.value = soundVal<br>document.forms[2].visc.value = viscVal<br>document.forms[2].mach.value = machVal<br>document.forms[2].q.value = qVal<br>document.forms[2].cpstar.value = (Math.pow((1/1.2 + machVal*machVal/6.0),3.5)-1)/(0.7*machVal*machVal)<br>document.forms[2].cpmin.value = -1.0/(0.7*machVal*machVal)<br>document.forms[2].reno.value = reynolds<br>document.forms[2].cfl.value = cflam<br>document.forms[2].cft.value = cfturb<br>if (origUnits == "metric") {<br>setMUnits(); <br>}<br>roundAll();<br>}<br>// Rounding<br>function roundAll(){<br>document.forms[1].alt.value = truncNum(document.forms[1].alt.value,9)<br>document.forms[1].speed.value = truncNum(document.forms[1].speed.value,7)<br>document.forms[1].rlength.value = truncNum(document.forms[1].rlength.value,7)<br>document.forms[2].temp.value =truncNum(document.forms[2].temp.value,7)<br>document.forms[2].rho.value = truncNum(document.forms[2].rho.value,7)<br>document.forms[2].press.value = truncNum(document.forms[2].press.value,7)<br>document.forms[2].ssound.value = truncNum(document.forms[2].ssound.value ,8)<br>document.forms[2].visc.value = truncNum(document.forms[2].visc.value,10)<br>document.forms[2].mach.value = truncNum(document.forms[2].mach.value,6)<br>document.forms[2].q.value = truncNum(document.forms[2].q.value,7)<br>document.forms[2].cpstar.value = truncNum(document.forms[2].cpstar.value,6)<br>document.forms[2].cpmin.value = truncNum(document.forms[2].cpmin.value,6)<br>document.forms[2].reno.value = truncNum(document.forms[2].reno.value,9)<br>document.forms[2].cfl.value = truncNum(document.forms[2].cfl.value,7)<br>document.forms[2].cft.value = truncNum(document.forms[2].cft.value,7)<br>return;<br>}<br>function truncNum(inputVal, rsize) {<br>var instr = " " + inputVal<br>var inputlength = instr.length<br>if (inputlength<=rsize+1) return instr.substring(1, inputlength);<br>var epos = strpos(instr, "e")<br>if ( epos > rsize+1) {<br>var instr1 = instr.substring(1,rsize+1) + instr.substring(epos,inputlength);<br>return instr1;<br>}<br>var rounded = instr.substring(1, rsize+1);<br>return rounded;<br>}<br>function strpos(str, ch) {<br>for (var i = 0; i < str.length; i++)<br>if (str.substring(i, i+1) == ch) return i;<br>return -1;<br>}<br>// End --><br></SCRIPT><br><br><!-- STEP TWO: Copy this code into the BODY of your HTML document --><br><br><BODY><br><br><FORM name = "units"><br>Select unit system: <br><INPUT TYPE="radio" VALUE="radio" NAME="unitbut" CHECKED="true" onClick="setEUnits()">English<br><INPUT TYPE="radio" VALUE="radio" NAME="unitbut" onClick="setMUnits()">Metric<br></FORM><br><p><br><HR><br><H3>Inputs</H3><br><FORM name="inputs"><br><table><br><tr><br><td>Altitude</td><br><td><INPUT NAME="alt" TYPE=text VALUE="0.0" SIZE=15></td><br><td><INPUT NAME="hunits" TYPE=text SIZE=6 VALUE="ft"></td><br></tr><br><tr><br><td>Speed</td><br><td><INPUT NAME="speed" TYPE="text" VALUE="1.0" SIZE="15"></td><br><td><INPUT NAME="vunits" TYPE="text" SIZE="6" VALUE="ft/sec"></td><br></tr><br><tr><br><td>Reference Length</td><br><td><INPUT NAME="rlength" TYPE="text" VALUE="1.0" SIZE="15"></td><br><td><INPUT NAME="lunits" TYPE="text" SIZE="6" VALUE="ft"></td><br></tr><br></table><br><BR><br><BR><br><INPUT NAME="name" TYPE="button" VALUE="Compute" onClick="Compute()"><br><INPUT NAME="name" TYPE="button" VALUE="Reset" onClick="ResetForm()"><br></FORM><br><HR SIZE="4"><br><H3>Results</H3><br><FORM name = "results"><br><table><br><tr><br><td>Temperature</td><br><td><INPUT NAME="temp" TYPE="text" SIZE="15"></td><br><td><INPUT NAME="tunits" TYPE="text" SIZE="8" VALUE="ƒR"></td><br></tr><br><tr><br><td>Density</td><br><td><INPUT NAME="rho" TYPE="text" SIZE="15"></td><br><td><INPUT NAME="runits" TYPE="text" SIZE="8" VALUE="sl/ft^3"></td><br></tr><br><tr><br><td>Pressure</td><br><td><INPUT NAME="press" TYPE="text" SIZE="15"></td><br><td><INPUT NAME="punits" TYPE="text" SIZE="8" VALUE="lb/ft^2"></td><br></tr><br><tr><td>Speed of Sound</td><br><td><INPUT NAME="ssound" TYPE="text" SIZE="15"></td><br><td><INPUT NAME="sunits" TYPE="text" SIZE="8" VALUE="ft/sec"></td><br></tr><br><tr><br><td>Viscosity</td><br><td><INPUT NAME="visc" TYPE="text" SIZE="15"></td><br><td><INPUT NAME="muunits" TYPE="text" SIZE="11" VALUE="lb sec/ft^2"></td><br><tr></tr><br></tr><br><tr><br><td>Mach Number</td><br><td><INPUT NAME="mach" TYPE="text" SIZE="15"></td><br></tr><br><tr><br><td>Dynamic Pressure</td><br><td><INPUT NAME="q" TYPE="text" SIZE="15"></td><br><td><INPUT NAME="qunits" TYPE="text" SIZE="8" VALUE="lb/ft^2"></td><br></tr><br><tr><br><td>Critical Cp</td><br><td><INPUT NAME="cpstar" TYPE="text" SIZE="15"></td><br></tr><br><tr><br><td>Vacuum Cp</td><br><td><INPUT NAME="cpmin" TYPE="text" SIZE="15"></td><br><tr><br></tr><br></tr><br><tr><br><td>Reynolds Number</td><br><td><INPUT NAME="reno" TYPE="text" SIZE="15"></td><br></tr><br><tr><br><td>Laminar Cf</td><br><td><INPUT NAME="cfl" TYPE="text" SIZE="15"></td><br></tr><br><tr><br><td>Turbulent Cf</td><br><td><INPUT NAME="cft" TYPE="text" SIZE="15"></td><br></tr><br></table><br></FORM><br><br> <br><br><br><br><br><br><br><font face="Tahoma"><a target="_blank" href="http://usefull-script.blogspot.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a> </font><br /><br><br /><br>
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Best script category
Alert Message
(2)
Background Effect
(5)
Buttons
(11)
Calculators
(6)
Forms
(3)
Fun Script
(1)
Java script
(3)
Miscellaneous
(2)
PHP Script
(10)
Search Box
(2)
Blog Archive
▼
2009
(57)
►
November
(7)
▼
October
(50)
Try this one or "Never say No"
Make a search engine for your own site
Make a Stopwatch with the help of Java Script
Email validation script in Php
Automatic Download script in Php
Simple email button to send E-mail Someone
Form design Agree Before Entry
Make a simple Downloaded file counter in Php
Make a simple web counter with the help of Php script
Simple Zip extractor script in Php
Easy File Upload Program in Php
Sending email with PHP
make a Atmosphere calculator
make a Age calculators
Make a Advance calculators
Make a Adjusted Cost Base calculators
Make a Ad calculators
Make a five function calculators
Background effect in webpage -INSTALL CELL BG CHANGER
Background effect in webpage ( Blink the backgroun...
Background effect in webpage ( Ball drop effect)
Background effect in webpage (astronaut effect)
Background effect in webpage (alien-spacecraft eff...
Add Windows postion relared buttons
Inser some funny message with push button
Insert image button in your blogs
Headliner (Differnt effect of button)
Install email button in your web page
Clicks to submit button
Check box script for your web site
Add Button url link in your web site
APOLOGIZE E-MAIL script in web page
Add alert button in your site
Moving Text status
Text alert for enter and exit
Close the browser with a button
MSN Search in your web page
Google search in web page
Rain effects on your text
Fall Leaves in your web page
Snow fall in your web page
Magical title for weblogs or any pages on the int...
Star Moving in your web site back ground
Mouse movement decoration with heart symbole
Add fireworks on your website
Search box for website
Decorate your scrollbar (Color full scroll bar )
Make a home page of your web site
No right click of mouse
You can bring a message box or a alert a window wh...
Free Search Engine Submission
Followers
About Me
Ratnakar Mishra
View my complete profile
Number of visitors
No comments:
Post a Comment