Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<h1 class = "fp1"; style = "text-align:center; margin-bottom:30px; font-family: 'roboto', sans-serif; font-size:30px" >
  
  Fluid Power Formulas
  </h1>

<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif"> 
      Force (lbs) = 
    <input type="number" placeholder= "Pressure (psi)"id= "pressure1" value= ""   style='width: 99px' /> x  
    <input type= "number" placeholder= "Area (in²)" id= "area1" value= "" style='width: 99px' />
    <button = "equals" id="equals1" >=</button>
    <output type="number" id= "forceResult" ></output> 
  
 </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif"> 
  Gpm = 
  <input type="number"  placeholder= "rpm"id= "rpm2" value= ""
        style='width: 99px' /> x
  <input type="number"  placeholder= "Displacement (in³)"id= "displacement2" value= ""
         style='width: 150px'/> / 231
  
 <button = "equals" id="equals2" >=</button>
<output type="number" id= "gpmresult" ></output> 
</h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif"> 
  Hyd HP = 
  <input type="number"  placeholder= "gpm"id= "gpm3" value= ""
        style='width: 99px' /> x
  <input type="number"  placeholder= "Pressure (psi)"id= "psi3" value= ""
         style='width: 99px'/> / 1,714
  
 <button = "equals3" id="equals3" >=</button>
<output type="number" id= "hydHPResult" ></output> 
</h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
Torque (in lbs) = 
    <input type="number"  placeholder= "Pressure (psi)"id= "psi4" value= ""
           style='width: 99px'/> x  
    <input type= "number" placeholder= "Area (in³)" id= "area4" value= ""
           style='width: 99px'/> / 6.28
    <button = "equals4" id="equals4" >=</button>
    <output type="number" id= "torqueResult4" ></output> 
    </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
Torque (in lbs) = 
    <input type="number"  placeholder= "HP"id= "hp5" value= ""
          style='width: 99px' /> x 63,025 /  
    <input type= "number" placeholder= "rpm" id= "rpm5" value= ""style='width: 99px'/> 
    <button = "equals5" id="equals5" >=</button>
    <output type="number" id= "torqueResult5" ></output> 
    </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
Cylinder area (in²) = 
    <input type="number"  placeholder= "Diameter (in)"id= "dia6" value= ""
          style='width: 99px'/> ² x .7854 
    <button = "equals6" id="equals6" >=</button>
    <output type="number" id= "output6" ></output> 
    </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
EREA - Effected Rod End Area (in²) = 
    <input type="number"  placeholder= " Cyl. Dia. (in)"id= "dia12" value= "" style='width: 100px'/> ² x .7854 - 
   <input type="number"  placeholder= " Rod Dia. (in)"id= "rod12" value= ""style='width: 100px'/> ² x.7854 
    <button = "equals12" id="equals12" >=</button>
    <output type="number" id= "output12" ></output> 
    </h2>
<br>

<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
Cyl Time (seconds) =
 <input type="number"  placeholder= "Area (in²)"id= "dia7" value= "" style='width: 99px'/> x 
   <input type="number"  placeholder= "Stroke (in)"id= "stroke7" value= ""style='width: 99px'/> x .26 / 
   <input type="number"  placeholder= "gpm"id= "gpm7" value= ""style='width: 99px'/> 
    <button = "equals7" id="equals7" >=</button>
    <output type="number" id= "output7" ></output> 
    </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
Cyl HP =
 <input type="number"  placeholder= "Cyl. Speed (ft/min)"id= "cylSpeed8" value= ""style='width: 125px' /> x 
   <input type="number"  placeholder= "Cyl. Force (lbs.)"id= "cylForce8" value= "" style='width: 125px'/> / 33,000 
    <button = "equals8" id="equals8" >=</button>
    <output type="number" id= "output8" ></output> 
    </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
Cyl Adj. gpm on retract =
 <input type="number"  placeholder= "Cyl. Area (in²)" id= "cylArea9" value= "" style='width: 99px'/> x 
   <input type="number"  placeholder= "gpm" id= "gpm9" value= "" style='width: 99px'/> / 
   <input type="number"  placeholder= "EREA (in²)" id= "erea9" value= ""style='width: 99px' /> 
    <button = "equals9" id="equals9" >=</button>
    <output type="number" id= "output9" ></output> 
    </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif">
Cyl Speed (ft/min) =
 <input type="number"  placeholder= "Stroke (in)" id= "stroke10" value= "" style='width: 99px'/> x 5 /
   <input type="number"  placeholder= "Time (seconds)" id= "time10" value= ""style='width: 99px' /> 
    <button = "equals10" id="equals10" >=</button>
    <output type="number" id= "output10" ></output> 
    </h2>
<br>
<h2 style= "font-size:20px; font-family: 'Roboto', sans-sefif" >
Cyl Speed (ft/min) =
 <input type="number"  placeholder= "gpm" id= "gpm11" value= "" style='width: 99px'/> x 19.25 / 
   <input type="number"  placeholder= "Cyl. Area (in²)" id= "area11" value= "" style='width: 99px'/> 
    <button = "equals11" id="equals11" >=</button>
    <output type="number" id= "output11" ></output> 
    </h2>
              
            
!

CSS

              
                




              
            
!

JS

              
                let pressure = document.getElementById('pressure1');
let area = document.getElementById('area1');
let equals = document.getElementById('equals1');
let forceResult = document.getElementById('forceResult');

function force1 (pressure, area) {
  return pressure * area;
}

equals.onclick = function () {
    const pressureValue = Number(pressure.value)
  const areaValue = Number(area.value)
    const result = force1(pressureValue, areaValue)
  
  forceResult.innerHTML = result + " lbs"
}

const rpm2 = document.getElementById('rpm2');
const displacement2 = document.getElementById('displacement2');
const equals2 = document.getElementById('equals2');
const gpmresult = document.getElementById('gpmresult');
const c2 = 231

function gpm (rpm2, displacement2) {
  return rpm2 * displacement2 / c2;
}

equals2.onclick = function () {
    const rpmValue = Number(rpm2.value)
  const displacementValue = Number(displacement2.value)
    const result2 = gpm(rpmValue, displacementValue)
  
  gpmresult.innerHTML = result2 + " gpm"
}


const gpm3 = document.getElementById('gpm3');
const psi3 = document.getElementById('psi3');
const equals3 = document.getElementById('equals3');
const hydHPResult = document.getElementById('hydHPResult');
const c3 = 1714

function hydraulicHorsePower (gpm3, psi3) {
  return gpm3 * psi3 / c3;
}

equals3.onclick = function () {
    const gpmValue = Number(gpm3.value)
  const psiValue = Number(psi3.value)
    const hpResult = hydraulicHorsePower(gpmValue, psiValue)
  
  hydHPResult.innerHTML = hpResult + " HP"
}

const psi4 = document.getElementById('psi4');
const area4 = document.getElementById('area4');
const equals4 = document.getElementById('equals4');
const torqueResult4 = document.getElementById('torqueResult4');
const c4 = 6.28

function torque4 (psi4, area4) {
  return psi4 * area4 / c4;
}

equals4.onclick = function () {
    const psiValue = Number(psi4.value)
  const areaValue = Number(area4.value)
    const torque4Result = torque4 (areaValue, psiValue)
  
 torqueResult4.innerHTML = torque4Result + " in lbs"
}

const hp5 = document.getElementById('hp5');
const rpm5 = document.getElementById('rpm5');
const equals5 = document.getElementById('equals5');
const torqueResult5 = document.getElementById('torqueResult5');
const c5 = 63025

function torque5 (hp5, rpm5) {
  return (hp5* c5)/ rpm5 ;
}

equals5.onclick= function () {
    const hpValue = Number (hp5.value)
  const rpmValue = Number(rpm5.value)
    const torque5Result = torque5 (hpValue, rpmValue)
  
 torqueResult5.innerHTML = torque5Result + " in lbs"
}


const dia6 = document.getElementById('dia6');
const equals6 = document.getElementById('equals6');
const output6 = document.getElementById('output6');
const c6 = .7854


function cylArea6 (dia6) {
  return Math.pow(dia6,2) * c6 ;
}

equals6.onclick= function () {
    const diaValue = Number (dia6.value)
    const dia6Result = cylArea6 (diaValue)
  
 output6.innerHTML = dia6Result + " in²"
}

const dia12 = document.getElementById('dia12');
const rod12 = document.getElementById('rod12');
const equals12 = document.getElementById('equals12');
const output12 = document.getElementById('output12');
const c12 = .7854


function erea12 (dia12, rod12 ) {
  return (Math.pow(dia12,2) * c12) - (Math.pow (rod12, 2) * c12);
}

equals12.onclick= function () {
    const dia12Value = Number (dia12.value)
    const rod12Value = Number (rod12.value)
    const erea12Result = erea12 (dia12Value, rod12Value)
  
 output12.innerHTML = erea12Result + " in²"
}


const area7 = document.getElementById('area7');
const stroke7 = document.getElementById('stroke7');
const gpm7 = document.getElementById('gpm7');
const equals7 = document.getElementById('equals7');
const output7 = document.getElementById('output7');
const c7 = .26


function cylTime7 (area7, stroke7, gpm7) {
  return area7 * stroke7 * c7 / gpm7 ;
}

equals7.onclick= function () {
    const areaValue = Number (dia7.value)
    const strokeValue = Number (stroke7.value)
    const gpmValue = Number (gpm7.value)
    const cylTime7Result = cylTime7 (areaValue, strokeValue, gpmValue)
  
 output7.innerHTML = cylTime7Result + " Seconds"
}

const cylSpeed8 = document.getElementById('cylSpeed8');
const cylForce8 = document.getElementById('cylForce8');
const equals8 = document.getElementById('equals8');
const output8 = document.getElementById('output8');
const c8 = 33000


function cylHp8 (cylSpeed8, cylForce8) {
  return cylSpeed8 * cylForce8 / c8 ;
}

equals8.onclick= function () {
    const cylSpeedValue = Number (cylSpeed8.value)
    const cylForceValue = Number (cylForce8.value)
    const cylHp8Result = cylHp8 (cylSpeedValue, cylForceValue)
  
 output8.innerHTML = cylHp8Result + " HP"
}

const cylArea9 = document.getElementById('cylArea9');
const gpm9 = document.getElementById('gpm9');
const erea9 = document.getElementById('erea9');
const equals9 = document.getElementById('equals9');
const output9 = document.getElementById('output9');

function cylRetract9 (cylArea9, gpm9, erea9) {
  return cylArea9 * gpm9 / erea9 ;
}

equals9.onclick= function () {
    const cylArea9Value = Number (cylArea9.value)
    const gpm9Value = Number (gpm9.value)
    const erea9Value = Number (erea9.value)
    const cylR9Result = cylRetract9 (cylArea9Value, gpm9Value, erea9Value)
  
 output9.innerHTML = cylR9Result + " gpm"
}

const stroke10 = document.getElementById('stroke10');
const time10 = document.getElementById('time10');
const c10 = 5

function cylSpeed10 (stroke10, time10) {
  return stroke10 * c10 / time10 ;
}

equals10.onclick= function () {
    const stroke10Value = Number (stroke10.value)
    const time10Value = Number (time10.value)
    const cylSpeed10Result = cylSpeed10 (stroke10Value, time10Value)
  
 output10.innerHTML = cylSpeed10Result + " ft/min"
}

const gpm11 = document.getElementById('gpm11');
const area11 = document.getElementById('area11');
const c11 = 19.25

function cylSpeed11 (gpm11, area11) {
  return gpm11 * c11 / area11 ;
}

equals11.onclick= function () {
    const gpm11Value = Number (gpm11.value)
    const area11Value = Number (area11.value)
    const cylSpeed11Result = cylSpeed11 (gpm11Value, area11Value)
  
 output11.innerHTML = cylSpeed11Result + " ft/min"
}

              
            
!
999px

Console