I am trying to create a page where you input how many miles you traveled and gallons of gas used, then press the button. The page should display the miles per gallon. The problem is I am not getting the miles per gallon calculation. Can someone please help me. Here is my code:
<html>
<head>
<title>mpg</title>
<script type=”text/javascript”>
function mpg()
{
var milestraveled, mpg, gallonsused;
milestraveled = parseFloat (document.GASForm.milestraveled.value);
gallonsused = parseFloat (document.GASForm.gallonsused.value);
mpg = milestraveled/gallonsused;
document.GASForm.mpg.value = mpg;
}
</script>
</head>
<body>
<H2>Miles Per Gallon Calculator </H2>
<form name = “GASForm”>
Miles traveled: <input type=”text” name=”milestraveled” size=10 value=0>
Gallons used: <input type=”text” name=”gallonsused” size=10 value=0>
<input type=”button” value=”Total Miles per gallon used” onclick=”mpg()”>
<input type=”text” name=”mpg” size=10>
</form>
</body>
</html>