i've got a project to be done using javascript and html....i don't know how to pass the arguments from <input type="text"> to the javascript function i'm using in my program. i just want the javascript script to calculate the input given by the user and return the answer.
here is the program:

<html>
<head>
<title>
Taxi Fare
</title>
<script lang="text/javascript">
// calculates taxi fare based upon miles traveled 
// and the hour of the day in military time (0-23).
var taxiFare = function (milesTraveled, pickupTime) {
  var baseFare = 2.50;
  var costPerMile = 2.00;
  var nightSurcharge = 0.50; // 8pm to 6am, every night

  var cost = baseFare + (costPerMile * milesTraveled);

  // add the nightSurcharge to the cost if it is after 
  // 8pm or before 6am
  if (pickupTime >= 20 || pickupTime < 6) {
      cost += nightSurcharge;
  }

  return cost;
};
</script>
</head>
<body>
<form>
<input type="text" onclick="taxiFare()" value="Call function">
<input type="Submit" value="OK" onclick="taxiFare()">
<input type="reset" value="Clear">
</form>
<script type="text/javascript">
document.write("Your taxi fare is ₹" + taxiFare(5,2));
</script>
</body>
</html>

pls its really urgent...i need to submit it by 2morrow.....pls it would be of great help. Thanx.

Hi,

If you add an ID attribte in that Input field, you can use this sintax in JavaScript to get the value of that input:

var valinp = document.getElementById('id_field').value;