Thx for the reply, but i got a solution elsewhere.
This is the solution i got, and it works perfectly:
Code:
<script type="text/JavaScript">
function calc(f) {
var tot, elms, val = parseInt(f.fee.value);
if (val=="" || !(val-1<val)) {
f.total_fee.value = 0;
return;
}
tot = 0;
elms = f.elements["hour[]"];
for (i=0,j=elms.length; i<j; i++) {
val = parseInt(elms[i].value);
if (val!="" && val-1<val) tot += val;
}
f.total_hour.value = tot;
f.total_fee.value = tot * parseInt(f.fee.value);
}
</script>
<form>
Fee: <input type="text" name="fee" onblur="calc(this.form)"><br>
Hour: <input type="text" name="hour[]" onblur="calc(this.form)"><br>
Hour: <input type="text" name="hour[]" onblur="calc(this.form)"><br>
Hour: <input type="text" name="hour[]" onblur="calc(this.form)"><br>
<hr>
Total Hours: <input type="text" name="total_hour" onblur="calc(this.form)"><br>
Total Fee: <input type="text" name="total_fee" onblur="calc(this.form)"><br>
</form>
Bookmarks