mptwoadmin
Programmer
Hi All, I would like some assistance with the following code: I am try to get the percentage of 2 inputted times and have another field auto populate but I am not that familiar with JavaScript and "times",(i can get two numbers to work but not the times). Any help would be great or if someone could lead me in the right directions. (an example to get me started would also be helpful.
Both time vales are the time it has taken someone to complete a job.
<script type="text/javascript">
function calc(A,B,SUM) {
var one = Number(A);
var two = Number(document.getElementById(B).value);
document.getElementById(SUM).value = one + two;
}
</script>
<form>
<input style="text-align: right" name="sum1" id="op1"
onChange="calc(this.value,'op2','result')" readonly value="12:10:30"/>
<input name="sum2" style="text-align: right" id="op2"
onChange="calc(this.value,'op1','result')" value="07:10:30" />
<input name="sum" id="result" readonly style="text-align: right">
</form>
Thanks
Both time vales are the time it has taken someone to complete a job.
<script type="text/javascript">
function calc(A,B,SUM) {
var one = Number(A);
var two = Number(document.getElementById(B).value);
document.getElementById(SUM).value = one + two;
}
</script>
<form>
<input style="text-align: right" name="sum1" id="op1"
onChange="calc(this.value,'op2','result')" readonly value="12:10:30"/>
<input name="sum2" style="text-align: right" id="op2"
onChange="calc(this.value,'op1','result')" value="07:10:30" />
<input name="sum" id="result" readonly style="text-align: right">
</form>
Thanks