@Robert Gentel,
Hi, I was following the information on this page for using the onchange() and parseInt. And I was able to get the code to work as it is displayed on this page. But I had some additional issues and when I tried to refine the code somewhat I seem to have broken it. However, I can't seem to figure out where. Any help would be appreciated.
Code:
<html>
<head>
<title>Time Difference</title>
</head>
<script>
function myFunction()
{
outS45 = document.incidentForm.outS45.value;
inS45 = document.incidentForm.inS45.value;
outhhmm = outS45.split(":");
outhh = parsInt(outhhmm[0], 10);
outmm = parsInt(outhhmm[1], 10);
inhhmm = inS45.split(":");
inhh = parsInt(inhhmm[0], 10);
inmm = parsInt(inhhmm[1], 10);
if (outhh < inhh)
{
tothhmm[0] = inhh - outhh + 24;
}
else
{
tothhmm[0] = inhh - outhh;
}
if (outmm < inmm)
{
tothhmm[1] = inmm - outmm + 60;
}
else
{
tothhmm[1] = inmm - outmm;
}
tothhmm = tothhmm.join(":");
document.incidentForm.totS45.value = tothhmm;
}
</script>
<body>
<form name="incidentForm">
<input size="10" type="text" id="outS45" name="outS45" value="" placeholder="hh:mm" onChange="myFunction()" />
<input size="10" type="text" id="inS45" name="inS45" value="" placeholder="hh:mm" onChange="myFunction()" />
<input size="10" type="text" id="totS45" name="totS45" value="" placeholder="hh:mm" readonly onChange="myFunction()" />
</form>
</body>
</html>