
Untitled
By: a guest on
Sep 11th, 2012 | syntax:
HTML | size: 0.65 KB | hits: 17 | expires: Never
<!doctype html>
<html>
<head>
<title>Gas price calculator</title>
<meta charset="utf-8" />
<script>
function calculate(){
document.getElementById("answer").innerHTML=
document.getElementById("litres").value*1.382+" euros is the price you have to pay for this amount of 95 octane gas.";
}
</script>
</head>
<body>
<h1>Gas price calculator</h1>
<h4>(Octane number 95 - price as of 10th September)</h4>
<div>
How many litres you want to buy:
<input type="text" id="litres" />
<input type="button" value="Enter" onclick="calculate()" />
</div>
<div id="answer">
</div>
</body>
</html>