hi all,
i am having some issues with coding a form
firstly i am new at this and it is seemly frustrating when you don't know what you are doing, here goes;
i have 4 drop down menus labeled as with static input as 0-9;
JobPerReview1
JobPerReview2
JobPerReview3
JobPerReview4
if for choice the user selects the following;
JobPerReview1 = 3
JobPerReview2 = 0
JobPerReview3 = 5
JobPerReview4 = 9
i would like a function/ script to sum the total inputs as an integer or if that's the correct term for it.
so it would calculate something like this
JobPerReview1 = 3 summed as 1
JobPerReview2 = 0 summed as none
JobPerReview3 = 5 summed as 1
JobPerReview4 = 9 summed as 1
i would also like a total box labeled "NOF (number of factors)
to calculate the selections such as;
NOF = 3
please assist this is starting to be mind bugling
function getItems()
{
var items = new Array();
var itemCount = document.getElementsByClassName("items");
var total = 0;
var id= '';
for(var i = 0; i < itemCount.length; i++)
{
id = "p"+(i+1);
total = total + parseInt(document.getElementById(id).value);
}
document.getElementById('tot').value = total;
return total;
}
getItems();
function getItems()
{
var items = new Array();
var itemCount = document.getElementsByClassName("items");
var total = 0;
var id= '';
for(var i = 0; i < itemCount.length; i++)
{
id = "p"+(i+1);
total = total + parseInt(document.getElementById(id).value);
}
document.getElementById('tot').value = total;
return total;
}
getItems();