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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <html lang="es">
<head>
   <meta charset="utf-8">
   <meta name="author" content="Rodrigo Iván Avila Demitroff">
   <!--<meta name="viewport" content="width=device-width, initial-scale=1.0">-->
   <title>
   Operaciones Unitarias I
   </title>
   <style>
        /*#wob {
        color: white;
        background-color: black;
        }*/
	body {
	color: black;
	background-color: white;	
	}
	/*#tablebow{
		border: 1px solid black;
		border-collapse: collapse;	
	}
	#tablewob{
		border: 1px solid white;
		border-collapse: collapse;	
	}
	th{
		border: 1px solid black;
		border-collapse: collapse;
	}*/
	footer{
		position: static;
		bottom: 10px;
	}
	input{
		padding:5px;
	}
   </style>
</head>
<body>
    <h2>Diámetro mínimo según pérdida máxima</h2>
	<!--<form>
	<input type="radio" name="contraste" value="true" checked onclick="contrast(true)">Alto contraste<br>
	<input type="radio" name="contraste" values="false" onclick="contrast(false)">Normal<br>
	</form>-->

    <p>Este documento contiene un pequeño programa en JavaScript.<br>
    Acepta notación científica. Ejemplo 2.3e-2 = 0.023</p>

 <fieldset> <!--style="width:45%"-->
  <legend><strong>Datos</strong></legend>
  <table>
  <tr><td>Caudal [m³/s]</td><td><input type="number" id="caudal" autofocus></td></tr>
  <tr><td>Longitud [m]</td><td><input type="number" id="longitud" placeholder="L+Leq"></td></tr>
  <tr><td>Pérdida máxima de cabeza [m]</td><td><input type="number" id="headLoss"></td></tr>
  <tr><td>Viscosidad dinámica [kg/m·s]</td><td><input type="number" id="visc"></td></tr>
  <tr><td>Densidad [kg/m³]</td><td><input type="number" id="densidad" value="998"></td></tr>
  <tr><td>Rugosidad absoluta [m]</td><td><input type="number" id="rugosidad"></td></tr>
  </table>
 </fieldset>
  <button onclick="pipes()" id="submit">Submit</button><span class= "toErase" id="appear"></span>

  <div>Diámetro<span class="toErase ith"></span>: <span class= "toErase" id="diametroRes"></span>&nbsp; m</div>
  <div>Reynolds<span class="toErase ith"></span>: <span class= "toErase" id="reyRes"></span></div>
  <div>Rugosidad relativa<span class="toErase ith"></span>: <span class= "toErase" id="rugRelRes"></span></div>

  <button onclick="clean()" style="background-color:red"><strong>Clear</strong></button>
  <footer>
	<small>&copy; 2018 Rodrigo Iván Avila Demitroff.</small>
  <footer>
              
            
!

CSS

              
                body {
  background-color: black;
  color: white;
}
              
            
!

JS

              
                /*MIT License

Copyright (c) 2018 Rodrigo Ivan Avila Demitroff

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var beenHere = 0;
var f_i = 0.04;
var ith = 0;

function pipes(){
	var caudal = document.getElementById("caudal").value;
	var longitud = document.getElementById("longitud").value;
	var headLoss = document.getElementById("headLoss").value;
	var viscosidad = document.getElementById("visc").value;
	var densidad = document.getElementById("densidad").value;
	var rugosidad = document.getElementById("rugosidad").value;
	var a = 0.0;
	var reConst = 0.0;
	var g = 9.81;

	a = 8 * caudal**2 * longitud / (headLoss * g * Math.pow(Math.PI, 2));
	reConst = 4 * caudal / (Math.PI * (viscosidad/densidad));
	if (0 == beenHere) {document.getElementById("appear").innerHTML = "<input type='number' placeholder='nuevo f' id='endgame'>";}
    else {f_i = document.getElementById("endgame").value;}
    beenHere = 1;
	var x = document.getElementsByClassName("ith");
	for (var i = 0; i<x.length; i++) {x[i].innerHTML = ith;}
	ith++;
	document.getElementById("diametroRes").innerHTML = Math.pow((a*f_i),(1/5));
	document.getElementById("rugRelRes").innerHTML = rugosidad/((a*f_i)**(1/5));
	document.getElementById("reyRes").innerHTML = reConst/Math.pow(a*f_i,1/5);
}

function clean(){
	document.getElementById("appear").innerHTML = "";
	beenHere = 0;
	f_i = 0.04;
	ith = 0;
	var x= document.getElementsByClassName("toErase");
	for (var i = 0; i < x.length; i++) {x[i].innerHTML= ""}
}
              
            
!
999px

Console