Skip to content

Instantly share code, notes, and snippets.

@tdouce
Created February 18, 2010 19:27
Show Gist options
  • Save tdouce/307957 to your computer and use it in GitHub Desktop.
Save tdouce/307957 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script type='text/javascript'>
// document.test.textRoof.value and works
function calculate()
{
var roof = document.test.txtRoof.value;
var precip = document.test.txtPrecip.value;
var eff = document.test.txtEff.value;
var eff_percent = (eff/100);
var conv_factr = 0.623;
var capt_area = document.test.txtArea.value;
var capt_area_percent = (capt_area/100);
var total = (roof * precip * conv_factr * capt_area_percent * eff_percent);
var total_rnd = Math.round(total);
document.write("Approximately " + total_rnd + " gallons can be collected off your roof annualy.");
}
</script>
<body>
<form name='test'>
Collection Footprint Area (square feet) <input type='text' name='txtRoof' value=''/><br />
Annual precipitation in your area (inches) <input type='text' name='txtPrecip' value=''/><br />
Efficiency with which you are going <br/>to caputure rain (%)<input type='text' name='txtEff' value=''/><br />
The amount of roof area from which <br/> you are going to caputure rain (%) <input type='text' name='txtArea' value=''/><br />
<input type='submit' value='Check Form' onClick='calculate()'/>
</form>
</body>
</html>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment