Hi, I have writen this script to calculate the difference between two periods of time and enter it into a text box, here is my script
<script>
if amPmOne.toLowerCase = ‘pm’ then hourOne = hourOne +12
if amPmTwo.toLowerCase = ‘pm’ then hourTwo = hourTwo + 12
function calc {if calc.onClick then
finalHours = hourTwo – hourOne
finalMinutes = minuteTwo – minuteOne
finalTime = finalHours + (finalMinutes / 60) }
</script>
<style>
body {margins:0; font-face:arial;}
</style>
<form name=”calc_flight_time”>
<table width=”361″ border=”0″>
<tr>
<td width=”161″><strong>Departed At</strong></td>
<td width=”88″><input name=”hourOne” type=”text” id=”hourOne” size=”5″>
:
<input name=”minuteOne” type=”text” id=”minuteOne” size=”5″></td>
<td width=”137″><select name=”amPmOne”>
<option value=”am”>am</option>
<option value=”pm”>pm</option>
</select></td>
</tr>
<tr>
<td><strong>Arrived At</strong></td>
<td><input name=”hourTwo” type=”text” id=”hourTwo” size=”5″>
:
<input name=”minuteTwo” type=”text” id=”minuteTwo” size=”5″></td>
<td><select name=”amPmTwo” id=”amPmTwo”>
<option value=”am”>am</option>
<option value=”pm”>pm</option>
</select></td>
</tr>
<tr>
<td><input name=”calcflttime” type=”submit” id=”calcflttime” value=”Calculate…” onClick=”javascript(calc)”></td>
<td><input name=”finalHours” type=”text” id=”hourTwo23″ size=”5″>
:
<input name=”finalMinutes” type=”text” id=”finalMinutes” size=”5″></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input name=”finalTime” type=”text” id=”hourTwo222″ size=”12″></td>
<td> </td>
</tr>
</table>
<p> </p>
</form>
what am I doing wrong?
Ben