How can i create a HTML aquarium volume calculator so when you put in the dimensions of the tank, it calculates the volume in gallons?
If you have the measurements of the tank, for example in inches, you can calculate the number of gallons. For example, lets say you have a tank that is 36" wide, 24" deep, and 24" tall, calculate 36x24x24, which equals 20736 cubic inches. Since each cubic inch equals .004329 gallons, multiply 20736 by .004329, which gives you roughly US 89.77 gallons, or 74.78 UK Gallons.
In HTML, you wouldn't. You'd most likely use javascript to do it. Here is a quick and dirty one, which should get you to a starting point (Demo Here): <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript" src="http://www.fishlore.com/scripts/js/share.js"></script> <script type="text/javascript"> var result = 0; var roundLength = 2; function computeGallons() { result = Math.round((document.frmMain.TankLength.value * document.frmMain.TankWidth.value * document.frmMain.TankHeight.value / 231)*100)/100; document.frmMain.USGallons.value = Math.round(result*100)/100; document.frmMain.UKGallons.value = Math.round((result * 0.833)*100)/100; } </script> <form name="frmMain"><span class="b">Aquarium Calculator: Calculate Rectangle Fish Tank Volume in Gallons Based on Tank Size</span><p> Fish Tank Length in Inches:<br /> <input type="text" name="TankLength" onkeyup="computeGallons()"><br /> <br /> Fish Tank Width in Inches:<br /> <input type="text" name="TankWidth" onkeyup="computeGallons()"><br /> <br /> Fish Tank Height in Inches:<br /> <input type="text" name="TankHeight" onkeyup="computeGallons()"><br /> <br /> Aquarium Size is<br /> <input type="text" name="USGallons"> US Gallons<br /> <br /> Aquarium Size is<br /> <input type="text" name="UKGallons"> UK Gallons<br /> </form> Code (markup):
Note that I am no javascript guru; I rarely use it. So, there may be extraneous things in here that are not needed.