I'm trying to make a form that can calculate the cost of travel from distance A to B. I'm using google maps to find the time between the distances. Than calculating the cost in javascript. I'm pretty new to this so I haven't even been able to get the calculating cost part working right. If any has any assistance to offer I'd be greatly appreciative, below is my script. Thanks for any replies.



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Travel Cost A to B</title>


function makeHours() {

cloHour = (form.cloHour.value);

cloMin = (form.cloMin.value);

cloSec = (form.cloSec.value);

decHour (cloHour + cloMin/60 + cloSec/3600);


function findRate()


var decHour, rate1, rate2, cost1, cost2;

decHour = document.Credit.decHour.value;

rate1 = 45;

rate2 = 50;

cost1 = document.Credit.cost1.value;

cost2 = document.Credit.cost2.value;

document.Credit.cost1.value = (decHour * rate1) + 40;

document.Credit.cost2.value = (decHour * rate2) + 40;



<form method="get" action="http://maps.google.com/maps">
<p><label for="saddr">Enter your address:</label>
<input type="text" id="saddr" name="saddr" />
<input type="submit" value="Go" />
<input type="hidden" value="(ADDRESS VALUE)" name="daddr" />
<input type="hidden" value="en" name="hl" /><br />
<DD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Street address City ST, ZIP</p>
<p><form name="Credit">

<table border="0" cellpadding="0" cellspacing="0">

<tr><td width="100"><div align="right">Hours =</div></td>

<td><input type="text" name="cloHour" size="10"></td></tr>

<tr><td width="100"><div align="right">Minutes =</div></td>

<td><input type="text" name="cloMin" size="10"></td></tr>

<tr><td width="100"><div align="right"></div></td>

<td><input type="hidden" value="00" name="cloSec" size="10"></td></tr>

<tr><td width="100"><div align="right"></div>$45/Hr =</td>

<td><input type="text" name="cost1" size="10"></td></tr>

<tr><td width="100"><div align="right"></div>$50/Hr =</td>

<td><input type="text" name="cost2" size="10"></td></tr>

<tr><td width="100"><br><br></td><td>

<input type="button" value="CALCULATE TRAVEL COST" onClick="this.form.cost1.cost2.value=makeHours(this.form),findRate();">