<input type=”number” name=”x”><p>
<button onclick=”myFunction(x)”>Do It!</button>
demoP.innerHTML=”= ” + x.value/2;
This script gives you a small form box for entering a number and when you click “Do It!”, it divides that number by 2 and displays the result.
By changing the mathematical operation in the “demoP.innerHTML=”= ” + x.value/2;” line, I am able to use this script as a solid template for creating other scripts that do simple calculations such as converting minutes to hours.