javascript - How To Make a Mobile Friendly Calculator for HTML Website -


i have new construction website , our customers calculator can estimate of how many bags of cement need project. should able input length, width, , height of wall/volume. should produce amount of bags need.

i looking simple, being mobile friendly key. should keep them on same page, no redirects or anything, way can change without having go back.

javascript gonna optimal this, if there better system i'll take it.

for simplicity bag of concrete fills 1 cubic foot.

you seem new both stack overflow , web development consider 1 freebe. recommend going w3 schools , getting firm understanding of html input controls javascript.

once have decent understanding take @ tutorials chrome's developer tools. every websites html, css, , javascript (usually) openly visible view. googling "concrete calculator" found ton of websites similar processes. "right click" -> "inspect element -> open "sources" tab -> navigate "js" folder , have exact code wrote same thing. http://www.concretenetwork.com/concrete/howmuch/calculator.htm has pretty easy read jquery example.

function change(){      var length = document.getelementbyid('length').value;      var width = document.getelementbyid('width').value;      var height = document.getelementbyid('height').value;      var cubicfeet = (length * width * height)      var weight = cubicfeet * 133      var numofbags = weight / 60      document.getelementbyid("cubicfeet").innerhtml = cubicfeet + " cubic feet";      document.getelementbyid("weight").innerhtml = weight + " lbs";      document.getelementbyid("numofbags").innerhtml = numofbags + " bags (60 lbs per bag)";  }
<center>    <form>      length:<br>      <input type="text" id="length" onkeyup="change()" />      <br>      width:<br>      <input type="text" id="width" onkeyup="change()" />      <br>        height:<br>      <input type="text" id="height" onkeyup="change()" />    </form>    <div id="cubicfeet"></div>    <div id="weight"></div>    <div id="numofbags"></div>  </center>


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -